in reply to Regexp: can I do it in one go?
#!/usr/bin/perl -wl use strict; my $s = 'aaaabababbbbaaaccccbbbbbbaadddd'; print $s; $s =~ s/((.)\2+)/length($1) . $2/eg; print $s; __END__ Prints: aaaabababbbbaaaccccbbbbbbaadddd 4ababa4b3a4c6b2a4d
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regexp: can I do it in one go?
by moxliukas (Curate) on Aug 22, 2002 at 11:40 UTC |