Prints($_ = 'aaab') =~ m/(.)((?!\1).)/ and print "$1|$2";
Another cool way to do the same match is with the match-time pattern interpolation technique:a|b
Prints...$_ = 'aaaabbbccddee'; while (m/(.)(.)(??{$1 eq $2})/g) { print "$1|$2\n"; }
a|b b|c c|d d|e
In reply to Re: Regex backreference problem.
by Roger
in thread Regex backreference problem.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |