Skip to main content
Inspiring
October 6, 2008
Question

Regular Expression help please!

  • October 6, 2008
  • 1 reply
  • 566 views
I am in need of 2 regular expressions, one that will validate a minimum of 2 decimal places ie: 1283772.23, just must enter 2 decimal places.

The other that I need is one that validates a time for a race, example: 04:03.4

Any help would be appreciated, thanks !!
    This topic has been closed for replies.

    1 reply

    Inspiring
    October 6, 2008
    First one ^\d+(\.\d{1,2})?$ Second one ^\d{1,2}:[0-5]\d\.\d$
    pflynn02Author
    Inspiring
    October 6, 2008
    The first one doesnt appear to force 2 decimal places, I can enter just 1 and it passes? I havent tested the second one yet...
    Inspiring
    October 6, 2008
    This will allow any number of decimal places as long as you have at least 2
    ^\d+\.\d{2,}$

    This one will allow 2 decimal places only
    ^\d+\.\d\d$