Title: RE: RegEx to remove \x0D\x0A
Are you sure they are CRLF's? And why regex? Why not chomp?
Can you give us a bit of actual data?
-Original Message-
From: Bullock, Howard A. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 01, 2003 12:14 PM
To: '[EMAIL PROTECTED]'
Subject
Bullock, Howard A. [EMAIL PROTECTED] wrote:
My script slurps in a file
Local $/;
$data = FILE;
and want to remove the CRLF's. but even a simple RegEx match does not
succeed for me.
These all have failed.
print \nYES\n if $data =~ /\015\012/;
print \nYES\n if $data =~ /\015\012/s;
text file for this test as I am only perplexed by the
\x0D\x0A behavior.
-Original Message-
From: Peter Eisengrein [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 1:53 PM
To: Bullock, Howard A.; '[EMAIL PROTECTED]'
Subject: RE: RegEx to remove \x0D\x0A
Are you sure
For #1 and #2 below: The file has data. I have examined it in two different
Hex editors and printed it to the display.
For #3: my script has 'local $/'. Outlook though it was being helpful. :(
I guess a simple question is should this be working? If so, I will continue
to work with it.
, October 01, 2003 2:15 PM
To: Bullock, Howard A.
Subject: RE: RegEx to remove \x0D\x0A
Did you add these two lines after reading in the file?
print len=, length( $data ), \n;
print data='$data'\n;
Does the length equal the file size?
Do you see multiple lines?
Both of these would indicate
'; '[EMAIL PROTECTED]'
Subject: RE: RegEx to remove \x0D\x0A
More testing shows that...
These two statements fail:
print \nYES\n if $data =~ /\x0D/s;
print \nYES\n if $data =~ /\x0d/s;
These two statements succeed:
print \nYES\n if $data =~ /\x0A/s;
print \nYES\n if $data =~ /\x0a/s
More testing shows that...
These two statements fail:
print \nYES\n if $data =~ /\x0D/s;
print \nYES\n if $data =~ /\x0d/s;
These two statements succeed:
print \nYES\n if $data =~ /\x0A/s;
print \nYES\n if $data =~ /\x0a/s;
As I stated before two different HEX editors show od oa sequences in my
Thank you for your help. Using binmode was indeed the solution.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs