Re: How can I output my numbers with commas added?
[email protected] (_brian_d_foy)
| Newsgroups | perl.perlfaq.workers |
|---|---|
| Message-ID | <070120031416354779%[email protected]> |
In article <[email protected]>, Pizza <[email protected]> wrote: > i offer the following regex in replacement to Mr. Goldberg's: > > s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; this one works. > s/([+-])?(\d{1,3})(?=(\d{3})+)/$1$2,/g; this one doesn't. make sure you try your solutions on a wide domain of data first. :) -- brian d foy, [email protected]