Gary King

Gary King

  • NA
  • 83
  • 209.1k

Regular Expression needed

Sep 19 2011 9:25 AM
Regular Expressions have always seemed like black magic to me and I have never been able to get my head around building them.
I am now in need of a Reg Exp (for validation putsposes) that checks that the user enters a number according to the following rules.

- no alpha characters
- can have decimal
- can have commas for the thousands, but the commas must be correctly placed

Some examples of VALID values:

1.23

100

1,234

1234

1,234.56

0.56

1,234,567.89


INVALID values:

1.ab

1,2345.67

0,123.45

1.24,687


Thanks
Gary


Answers (7)