in reply to Regular Expression match too much

m/^(?:$criteria)\z/
Ref: perlre

Replies are listed 'Best First'.
Re^2: Regular Expression match too much
by Roy Johnson (Monsignor) on Feb 08, 2006 at 20:13 UTC
    N.B.: If $criteria were a precompiled regex rather than a string being interpolated, the grouping parentheses would not be necessary.

    Caution: Contents may have been coded under pressure.
Re^2: Regular Expression match too much
by enemyofthestate (Monk) on Feb 08, 2006 at 20:11 UTC
    m/^(?:$criteria)\z/
    That was it! Thank you.
Re^2: Regular Expression match too much
by thor (Priest) on Feb 08, 2006 at 20:35 UTC
    Just out of curiostiy, why did you use \z and with ^ instead of \A?

    thor

    The only easy day was yesterday

      Little code &mdash I don't recall ever seeing any &mdash uses \A and \Z for regexps without /m. This is probably because the alternatives ^ and $ stand out more. I didn't see any reason for breaking this convention. If \a was an alias for \A, I would have used that.