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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to