|
|
| Problems? Is your data what you think it is? | |
| PerlMonks |
Need help with a regexby Sandy (Curate) |
| on Sep 15, 2006 at 10:13 UTC ( [id://573141]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.Sandy has asked for the wisdom of the Perl Monks concerning the following question:
UPDATE!!
It isn't a regex problem at all!. It was the way I was reading in the file. I erroneously had $/='';, but then it only read my data up to, but not including the blank line. When I changed the above code to undef $/, everything works fine. Oops! END_OF_UPDATE Hello all, I have a file that I need to parse. Each page has a header and a page number. At this point, I am having difficulties just grabbing the header for each page (part of a more complex regex). Problem: If there is an extra line in front of page 54's header, the regex does not find this page. If the blank line is replaced with an 'x', the page header will be found.Code & output when it doesn't work: Result:
same code, slightly different data Result:
I'm using active state perl V5.6.1 on a windows 2000 professional machine. Any insight would be appreciated. Sandy UPDATE: Just a note: the code above was part of a series of test. The same result is obtained even if I use the 'sgmx' modifiers for the regex.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||