Click here to get back home

Regular expression to match month number 1,...,12 (including e.g. 04,05)

 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
Regular expression to match month number 1,...,12 (including e.g. 04,05) Matt Benson 09-14-2004
Get Chitika Premium
Posted by Matt Benson on September 14, 2004, 10:52 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

Posted by Paul Lutus on September 14, 2004, 2:06 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

Posted by Andres Monroy-Hernandez on September 15, 2004, 12:29 am
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
How do I match a | in a regular expression? December 18, 2006, 4:09 pm
Match a regular expression March 2, 2007, 11:57 am
regular expression match on the fly July 27, 2007, 2:27 am
Match regular expression from LEFT to right August 25, 2006, 9:49 am
FAQ 6.23 How do I match a regular expression that's in a variable? September 2, 2006, 3:03 am
Regular Expression Question Why Doesn't this Match? October 31, 2006, 10:51 pm
FAQ 6.23 How do I match a regular expression that's in a variable? November 22, 2006, 9:03 am
FAQ 6.23 How do I match a regular expression that's in a variable? February 28, 2007, 9:03 pm
FAQ 6.23 How do I match a regular expression that's in a variable? August 4, 2007, 3:03 pm
FAQ 6.23 How do I match a regular expression that's in a variable? October 21, 2007, 9:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap