470,833 Members | 1,962 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

replacing 1> crlfs

Hi,
recieving mail from various mail clients ... some for some reason put
anything up to 4 or 5 carriage breaks in some parts of message ...
ie /n/n/n/n (sometimes spaces in between ie /n/n /n/n)
or /r/r/r/r
so I need to replace any repeated line breaks with just one line break

any ideas?
cheers
Jul 17 '05 #1
1 1312
brendan wrote:
recieving mail from various mail clients ... some for some reason put
anything up to 4 or 5 carriage breaks in some parts of message ...
ie /n/n/n/n (sometimes spaces in between ie /n/n /n/n)
or /r/r/r/r
It's actually \n\n\n\n or \r\r\r\r (notice the backslash).
so I need to replace any repeated line breaks with just one line break


$msg = preg_replace("/[\r\n][\s]+/", "\r\n", $msg);
JW

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Sorby | last post: by
1 post views Thread by Christian Schmidbauer | last post: by
15 posts views Thread by tshad | last post: by
6 posts views Thread by tentstitcher | last post: by
14 posts views Thread by Adnan Siddiqi | last post: by
1 post views Thread by cma6 | last post: by
2 posts views Thread by John Smith | last post: by
4 posts views Thread by Gilles Ganault | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.