in reply to Re: Re: Match number with commas
in thread Match number with commas

$_ = 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
(_8(|)