Help for this page

Select Code to Download


  1. or download this
    /^\d+$/                      # integer
    /^\d+(?:\.\d+)?$/            # integer or optional real
    ...
    # Ways of doing optional integer portion (e.g. .12)
    /^\d*(?:\.(?:\d\d)?)?$/           # WRONG (matches "")
    /^\d+(?:\.(?:\d\d)?)?$|^\.\d\d$/  # better, but still ugly