replacing 1> crlfs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • brendan

    #1

    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
  • Janwillem Borleffs

    #2
    Re: replacing 1> crlfs

    brendan wrote:[color=blue]
    > 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[/color]

    It's actually \n\n\n\n or \r\r\r\r (notice the backslash).
    [color=blue]
    > so I need to replace any repeated line breaks with just one line break
    >[/color]

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


    JW



    Comment

    Working...