in reply to Is there an elegant way of resetting the match position?
Try
[0] Perl> $s = "Input String: aaAabBAAa";; [0] Perl> $n=1; print "'$1'" while $s =~ m[(?=((.)\2{$n}))]ig;; 'aa' 'aA' 'Aa' 'bB' 'AA' 'Aa' [0] Perl> $n=2; print "'$1'" while $s =~ m[(?=((.)\2{$n}))]ig;; 'aaA' 'aAa' 'AAa'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is there an elegant way of resetting the match position?
by LanX (Saint) on Oct 22, 2009 at 21:57 UTC |