in reply to Failed regex: negative look-behinds

Thus spaketh the doc perlre

"(?<!pattern)" A zero-width negative look-behind assertion. For exa +mple "/(?<!bar)foo/" matches any occurrence of "foo" that +does not follow "bar". Works only for fixed-width look-behind +.

Therefore, /\A(?<!compiled)[a-zA-Z0-9]+\z/ matches any occurance of one or more alphanumeric at the end of a string that does not follow "compiled"

You might also have an issue with operator associativity and/or precedence... from perlop, orhas much lower precedence (and left associativity) than eq...



--chargrill
$/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );

Replies are listed 'Best First'.
Re^2: Failed regex: negative look-behinds
by loikiolki (Novice) on Feb 07, 2006 at 06:04 UTC
    therefore, /\A(?<!compiled)[a-zA-Z0-9]+\z/ matches any occurance of one or more alphanumeric at the end of a string that does not follow "compiled"

    Which is exactly what I want to match, but the regex doesn't seem to match this any occurance of one or more alphanumeric at the end of a string that does not follow "compiled". *shrug*

      I think they're right up above, most notably ikegami and graff...

      the entire OP regex is anchored at start-of-string, so there's no place to "look-behind"



      --chargrill
      $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );