in reply to Regex won't match.

Probably what you're doing wrong is assigning the string to the variable wrong. But since you didn't show how you did that, it's just a guess.

Usually, what you want to do is this:

$TERMSDEF = qr/\b\w+\b|(?:'.+?')|(?:".+?")/;

That will preserve all the regex semantics, keep your code readable, cure cancer, etc.

Replies are listed 'Best First'.
Re^2: Regex won't match.
by ikegami (Patriarch) on Sep 21, 2009 at 02:19 UTC

    To be equivalent, it should be:

    $TERMSDEF = qr/\b\w+\b|(?:'.+?')|(?:".+?")/isx;

    Mind you, the "i" and "x" are useless here, but the "s" is necessary.

Re^2: Regex won't match.
by Anonymous Monk on Sep 20, 2009 at 22:57 UTC
    Excellent! It works now. Thank you.