The stupid question is the question not asked | |
PerlMonks |
regexp for scalar containing a mixture of LF & CRLFby NateTut (Deacon) |
on Dec 09, 2004 at 22:52 UTC ( [id://413710]=perlquestion: print w/replies, xml ) | Need Help?? |
NateTut has asked for the wisdom of the Perl Monks concerning the following question:
Monks;
I have a scalar containing text with a mixture of line ending characters (it's Lotus Notes e-mail message text). I want to replace all of the LFs to be CRLFs. I have tried many different regexp approaches. Below is the relevant snippet: $doc->{Body} contains the text with the mixture of LFs & CRLFs. This is a WinDoze app so I'm sure print is putting CRLFs on the line ends. In the s/ I've tried everything I can think of: \x0D instead of \015 s instead of m at the end, etc. I still end up with extranneous LFs left. I think it's a problem of my understanding of the concept of a line in a regexp or something. Doug ***Update*** here's how I finally got it to work. The problem was that I was trying to modify a Lotus Notes Object. Kudos to diotalevi for that tip. Doug Doug
Back to
Seekers of Perl Wisdom
|
|