[pmwiki-devel] changing \n to other delimiter
Patrick R. Michaud
pmichaud at pobox.com
Wed May 16 06:55:40 CDT 2007
On Wed, May 16, 2007 at 06:53:17AM +0200, Christophe David wrote:
> > 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]/', "||",
> Thanks again Christophe! Just what I needed to know. I ended up
> having to slightly modify the pattern...
> This is still not perfect, as two consecutive "blank" lines will be
> converted once.
> '/([\\r\\n]|\\r|\\n)/' is probably better.
This pattern doesn't catch CR+NL (\r\n) sequences. :-)
More information about the pmwiki-devel