No such thing as a small change | |
PerlMonks |
Re: Why doesn't this regex work?by mtmcc (Hermit) |
on Aug 15, 2013 at 10:40 UTC ( [id://1049547]=note: print w/replies, xml ) | Need Help?? |
I've looked through it with Regexp::Debugger.
Maybe (probably) I'm misunderstanding the question, but in your sample data, the hundred groups in each line seem to be the same. i.e. $1 + 1 will always not equal $2 in this data, for each line. I think the second point is about the spaces. When the regex matches, it skips a space, so misses out on matching the next number to the first part of the regex. For example, this inserts a newline before the 200s start:
But when you change the data to:
the first part of the regex doesn't match the 109, because the match fails on the first space. Apologies if I'm way off!
In Section
Seekers of Perl Wisdom
|
|