Click here to get back home

regex challange: collapse nested {} blocks

 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
regex challange: collapse nested {} blocks ken 11-19-2004
Posted by ken on November 19, 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 to remove blocks between nested brackets January 31, 2008, 7:55 am
Help: Nested quantifiers in regex Problem October 24, 2008, 12:50 am
making your OS collapse by using Perl March 3, 2006, 4:18 pm
END blocks and fork March 1, 2005, 2:23 pm
Using (?{}) code blocks and $^R September 19, 2007, 7:06 pm
Can not print blocks to files with << September 18, 2004, 10:39 am
perl Write filehandle blocks. April 29, 2007, 4:11 am
Re: Parsing blocks of text in Perl March 6, 2008, 6:00 am
Close function blocks forever when reading from piped output November 27, 2007, 4:16 pm
perl -pe for blocks of lines instead of single lines September 26, 2006, 1:29 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap