Regex gurus! here's a teaser: mixed thousands separators and csv's

Posted by chichilatte on Stack Overflow See other posts from Stack Overflow or by chichilatte
Published on 2010-05-01T00:32:38Z Indexed on 2010/05/01 0:37 UTC
Read the original article Hit count: 305

Filed under:
|

I've got a string like...

"labour 18909, liberals 12,365,conservatives 14,720"

...and i'd like a regex which can get rid of any thousands separators so i can pull out the numbers easily. Or even a regex which could give me a tidy array like:

(labour => 18909, liberals => 12365, conservatives => 14720)

Oh i wish i had the time to figure out regexes! Maybe i'll buy one as a toilet book, mmm.

© Stack Overflow or respective owner

Related posts about regex

Related posts about php