frankus has asked for the wisdom of the Perl Monks concerning the following question:
i.e. 123456789 = 123,456,789
I really thought this was a cool use for Regular Expressions. The problem as I saw it required the regular expression to work on the result. I came up with this:
It seems to lack some of the grace I have come to expect from regular expressions. Anyone got an idea.for(;;){s/^(\d+)(\d{3}($|,))(.*)/$1,$2,$4/;$2||last}
--Brother Frankus.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular question
by Fastolfe (Vicar) on Nov 09, 2000 at 23:24 UTC | |
|
RE: Regular question
by Blue (Hermit) on Nov 09, 2000 at 23:34 UTC | |
|
Regular question errata.
by frankus (Priest) on Nov 09, 2000 at 23:16 UTC |