Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: regexp for adding commas to a number

by tenatious (Beadle)
on Aug 18, 2000 at 07:06 UTC ( #28425=note: print w/replies, xml ) Need Help??


in reply to regexp for adding commas to a number

Out of Andrew Johnson's Elements of Perl Programming:
s/(\d{1,3}) (?= (?:\d\d\d)+ (?!\d) ) /$1,/gx;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://28425]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-09-27 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (122 votes). Check out past polls.

    Notices?