Need regular expression which have:

  1. Maximum 8 digits before decimal(.) point
  2. Maximum 4 digits after decimal point
  3. Decimal point is optional

Maximum valid decimal is 8 digits before decimal and 4 digits after decimal So 99999999.9999

The regular rexpression I have tried ^\d{0,8}[.]?\d{1,4}$ is failing for 123456789 and more than this. means it is taking more than 8 digits if decimal point is not available.

Tested here : http://regexpal.com/

Many many thanks in advance!

Edit
Report