
Zhris
Enthusiast
Jun 23, 2010, 9:09 PM
Post #3 of 4
(6624 views)
|
Re: [ejaggers1] RE for number with or w/o comma
[In reply to]
|
Can't Post
|
|
A basic expression which would allow commas to occur anywhere in the number string: m/^[0-9,]+$/ Or an untested expression which would allow a comma after the first number or not, then after every 3 numbers or not, although it would allow i.e. "1,234,56789,444": m/^\d\,?(\d{1,2}|\d{3}\,?)*$/ Sometimes I wonder if it would be easier to validate that the string contains just numbers or commas, remove all commas, then use sprintf to replace the commas in their proper places. Chris
(This post was edited by Zhris on Jul 25, 2010, 6:31 AM)
|