Like I said, bad choices don't make good examples \w also matches '8'.
Correct that and it is easy to see how to determine if the matches were consecutive from @- * @+
"&8" =~ /^(?=.*([A-Z]))(?=.*(\d))/ and print "[@-][@+]";; "A8" =~ /^(?=.*([A-Z]))(?=.*(\d))/ and print "[@-][@+]";; [0 0 1][0 1 2] "A+8" =~ /^(?=.*([A-Z]))(?=.*(\d))/ and print "[@-][@+]";; [0 0 2][0 1 3]
In reply to Re^7: Regex match at the beginning or end of string
by BrowserUk
in thread Regex match at the beginning or end of string
by cyber-guard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |