in reply to zero-width assertions for extended regular expressions

(?=\d) is a lookahead assertion.

In order to check for the presence of a digit before the rest of the match, you need a lookbehind assertion: (?<=\d)

See perlreref#EXTENDED-CONSTRUCTS for an overview of the different look-around constructs.

Replies are listed 'Best First'.
Re^2: zero-width assertions for extended regular expressions
by Laurent_R (Canon) on May 26, 2014 at 21:14 UTC
    Yep.
    $ perl -e 'my $string = "54W"; warn "1 true\n" if $string =~ /(?<=4)W/ +;' 1 true