Re: Regular Expression question..simple!



On Jan 30, 11:19 pm, "gene.el...@xxxxxxxxx" <gene.el...@xxxxxxxxx>
wrote:
Hey everyone! I am banging my head on this regular expression problem.
I want to validate US currency. So far I have '^(\.[0-9]+|[0-9]+(\.
[0-9]*)?)$'

but this fails if I use a commna (i.e. 2,000.00). Any help would be
greatly appreciated!

Use '^(\.[0-9]+|[0-9,]+(\.[0-9]*)?)$' - this will also accept
2,0,0,0.00
Or use ^(([0-9]{1,3},)*[0-9]{1,3}|[0-9]+)(\.[0-9]+)?$'

.