in reply to Re^2: match character in a set, them match one of the other ones
in thread match character in a set, then match one of the other ones
At you. moritz provided the fix. In addition to moritz's correction, you can also clean up your regex by eliminating the extraneous parentheses, which just serve to obfuscate what is going on:
use strict; use warnings; use 5.010; my @strings = ( 'aa', 'ab', 'a1', ); for my $str (@strings) { if ($str =~ / ([a-z]) (?!\1) [a-z] /x ) { say "$str: $1"; } } --output:-- ab: a
Thanks.
|
|---|