Regular Expression Help

  • Thread starter Thread starter ~J~
  • Start date Start date

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
Anyone in the know on Regular Expressions?

Got the following which will allow any number between 1 and 11...

^((0?[1-9])|((1)[0-1]))$

But I need the option as to whether the expression can allow decimal places to 2 points.

For example the following are all valid...

11.99
7
7.5
2.00

But the next lot are not valid...

12
12.01
5.999
0.001

Any any ideas?

TIA


*EDIT*

I *THINK* I've done it, works so far but if anyone knows of a flaw, I'd love to know...

^((0?[1-9])|((1)[0-1]))?((\.[0-9]{0,2})?|0(\.[0-9]{0,2}))$
 
Last edited:
Back
Top Bottom