Think about Loose Coupling | |
PerlMonks |
Re: Regexp Confuzzelemtby akho (Hermit) |
on Apr 27, 2007 at 21:41 UTC ( [id://612461]=note: print w/replies, xml ) | Need Help?? |
Regular expressions are greedy by default. That means (.*[^\?]) first matches the whole input for .*, backtracks one character and matches "c" for [^\?].
You want #(.*?)\? (the '?' makes the .* non-greedy). #([^?]*) also works, of course. But it also matches "TTT" in "aaaaaaaa#TTT" (note that there is no question mark).
In Section
Seekers of Perl Wisdom
|
|