Click to See Complete Forum and Search --> : Perl Reg Exp Problems


sjaguar13
April 18th, 2005, 12:35 PM
How do I get the numbers from a string if they are between a the beginning of the line, a comma, or a space, and a space, a comma, or the end of the line? For Example:
12, 3, "asdfasdfasd",0
"asdfasd", 23,3, 10, "023", 0

It should match the 12, 3, and 0 in the first line and the 23, 3, 10, and 0 in the second line.

I tried:
$line =~ /[^,\s](\d+)[$,\s]/g;

It didn't match anything.

sjaguar13
April 18th, 2005, 12:44 PM
Nevermind, I am an idiot and used the class [] instead of ().