Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Search and replace with new lines?
April 29, 2010, 1:10 am
rate this thread
I'm using PHP 5. Does anyone know how I can do a regular expression
search and replace when the target string contains carriage returns
('\n')? This is the code I have that isn't working ...
$pattern = '/' . TOTAL_START_TOKEN . '(.*)' .
TOTAL_END_TOKEN . '/';
$ecom_file_contents = preg_replace($pattern,
When the target string contains ('\n'), the expression doesn't work.
When it doesn't contain that character, the search and replace works
Thanks for your help, - Dave