Click here to get back home

Simple question reg string matching

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Simple question reg string matching K3 10-26-2006
Posted by K3 on October 26, 2006, 3:31 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
Simple question reg string matching October 26, 2006, 3:32 pm
Simple pattern matching negation October 4, 2005, 2:33 am
reg exact string matching November 1, 2006, 7:04 pm
Using a variable in a matching string November 21, 2006, 1:18 pm
string matching doesn't work November 1, 2007, 5:48 pm
Regex matching a string that DOESN'T contain a given word August 31, 2004, 1:07 pm
[perl-python] string pattern matching February 1, 2005, 1:45 pm
Matching final occurance of a string in text June 1, 2005, 10:16 am
Regular Expression check for non matching string September 22, 2005, 8:27 am
string matching specific number of times September 29, 2005, 6:51 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap