> > $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

Thanks again Christophe! Just what I needed to know.  I ended up
having to slightly modify the pattern...

'/[\\n\\r]{1,2}/'



This is still not perfect, as two consecutive "blank" lines will be
converted once.

'/([\\r\\n]|\\r|\\n)/' is probably better.

---
_______________________________________________
pmwiki-devel mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply via email to