regex problem

From: Date: Thu, 01 Jul 2004 21:41:50 +0000
Subject: regex problem
Groups: php.general 
Request: Send a blank email to php-general+get-189492@lists.php.net to get a copy of this message
I'm trying to get a simple regex to work. Here is the test script I have. #!/usr/bin/php -q <? $string = "hello\nworld\n"; $string = preg_replace("/[^\r]\n/i","\r\n",$string); $string = addcslashes($string, "\r\n"); print $string; ?> This outputs hell\r\nworl\r\n so it's removing the char before the \n also. I just want it to replace a lone \n with \r\n -Josh

« previous php.general (#189492) next »