simple regexp question - validating new line chars

From: Date: Sat, 08 Dec 2001 17:10:27 +0000
Subject: simple regexp question - validating new line chars
Groups: php.general 
Request: Send a blank email to php-general+get-77121@lists.php.net to get a copy of this message
Hi everyone:) I need to validate a string that comes from a submitted form. There's nothing unusual in it... but the problem part showes up, when I need to validate a new line character... I have tried many diffrent variations of the code and I have ended up on something VERY simple: <?php $regexp='\n'; $text="\n"; echo $text; if (true==eregi($regexp, $text)) { echo 'ok'; } else { echo 'error'; } ?> Unfortunately this script results with "error" ;( Does somebody know how to make this regexp to work? Maybe it is a bug? I am using php 4.0.6 on windows 2000. I will appreciate any feedback about this ;) Chris Jarecki

« previous php.general (#77121) next »