in reply to Re^6: Regex match at the beginning or end of string
in thread Regex match at the beginning or end of string
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]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Regex match at the beginning or end of string
by JavaFan (Canon) on Feb 20, 2011 at 15:25 UTC | |
by BrowserUk (Patriarch) on Feb 20, 2011 at 15:42 UTC | |
by JavaFan (Canon) on Feb 20, 2011 at 15:55 UTC |