in reply to Regex AND NOT with zero-width negative lookahead assertion

Haven't looked at hippo's answer yet but in the mean while I tried:

#!/usr/bin/perl use strict; use warnings; while( <DATA> ) { chomp ; print "$_ -> " ; if ( m/^\/(?:[^\/]|(?<=\\)\/)+\/$/ ) { print " matched\n" ; } else { print " not matched\n" ; } } __DATA__ /aaa/ /\a\a\a\/\b\b\b/ /aaa\/bbb/ /aaa/bbb/

Output

/aaa/ -> matched /\a\a\a\/\b\b\b/ -> matched /aaa\/bbb/ -> matched /aaa/bbb/ -> not matched