Do you know where your variables are? | |
PerlMonks |
negative lookahead to the rescue! (boo)by boo_radley (Parson) |
on Jul 24, 2001 at 20:47 UTC ( [id://99402]=note: print w/replies, xml ) | Need Help?? |
there are 4 sets of parens in the regex, I'll try to break them down : the first one looks for a pipe, then any number of characters (but not being greedy about it) the second grabs the lone quote the third is a negative lookahead. This is where is golden nugget of regular expression goodness lies! the negative lookahead makes sure that there's no quote following the one from the second backreference. Also, since it's a zero-width assertion, it doesn't create a backreference of its own. Finally, the last set of parens describes "the rest of the string" up to the ending pipe-delimiter.
So,
In Section
Seekers of Perl Wisdom
|
|