Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: regexp for scalar containing a mixture of LF & CRLF

by Eimi Metamorphoumai (Deacon)
on Dec 09, 2004 at 23:05 UTC ( #413713=note: print w/replies, xml ) Need Help??

in reply to regexp for scalar containing a mixture of LF & CRLF

I think what you want is
The problem with your code is that you're trying to replace a single CR with an LF, so if you have an LF alone, it's unchanged. If you start with CRLF, you end up with LFLF, which isn't what you want. What you need to look for is an LF not preceded by CR, and replace it with CRLF.

Update: It appears I spoke a little too soon, and with too much Unix-centrism. The text was fine, but I forgot that "\n" in Perl changes meaning under different platforms. What you want is


Replies are listed 'Best First'.
Re^2: regexp for scalar containing a mixture of LF & CRLF
by NateTut (Deacon) on Dec 09, 2004 at 23:59 UTC
    Thanks, but nope. See my next post for my ugly answer that finally worked.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413713]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2018-06-19 21:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (115 votes). Check out past polls.