(_8(|)$_ = 123456789; s/ # begin substitution operator (\d{1,3}) # match and capture one-to-three digits (?= # if they are followed by: (?:\d\d\d)+ # one-or-more groups of three digits (?!\d) # that are not followed by a digit ) # end lookahead assertion /$1,/gx; # /g = perform substitution repeatedly print; #prints: 123,456,789
In reply to Re: Re: Re: Match number with commas
by Baz
in thread Match number with commas
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |