in reply to Regex backreference problem.
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex backreference problem.
by Anonymous Monk on Oct 10, 2003 at 06:49 UTC |