in reply to Re: Regexp Confuzzelemt
in thread Regexp Confuzzelemt
But it also matches "TTT" in "aaaaaaaa#TTT"
That's a difference you introduced. If you put the \? back in, it won't.
/#(.*?)\?/
is equivalent to
/#([^?]*)\?/
The latter is safer. It's easy to introduced problems when using non-greedy quantifiers. They're not as resilient. For example, you can safely embed the greedy regexp in a larger regexp, but you can't safely embed the non-greedy regexp in a larger regexp.
|
---|
In Section
Seekers of Perl Wisdom