[pmwiki-devel] changing \n to other delimiter

Christophe David pmwiki at christophedavid.org
Tue May 15 11:48:40 CDT 2007


$out = str_replace("\n", "||", $in);
> $out = preg_replace('/\\n/', "||", $in);
>
> Both seem to do the replacement, but don't get rid of the line break...



Depending on your OS, you can have \r (MAC), \n (Unix) or \r\n (Windows) as
end of line delimiters.

This should work everywhere : $out = preg_replace('/[\\n\\r]/', "||", $in);

Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-devel/attachments/20070515/e12b5b94/attachment.html 


More information about the pmwiki-devel mailing list