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
Bullock, Howard A. [EMAIL PROTECTED] wrote:
> My script slurps in a file
>
> Local $/;
> $data = ;
>
> 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 =~ /\
an use any 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\
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.
-
Original Message-
From: Arms, Mike [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 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=&
t; To: 'Arms, Mike'; '[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;
>
> The
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 sequence
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