in reply to Search and Replace Regex

This is another answer:

my $wah = m/\(([^\)]+)\)/;
See Common Regex Gotchas for information on why this is so.

Regards.

Edit: Apologies to dpuu for misreading the above node and thanks for pointing this out. Both forms have their pros and cons as discussed in Ovid, Long Live .*? (dot star question-mark).

Replies are listed 'Best First'.
Re: Re: Search and Replace Regex
by dpuu (Chaplain) on Aug 22, 2002 at 00:03 UTC
    For which reason, specifically? AFAIK, the only difference is that /X(.*?)Y/ doesn't match newlines, whilst /X([^Y]*)Y/ does. --Dave