I am trying to build a regex which will allow both negative and positive decimal numbers with the following rules.

  1. there can not be more than 2 digits after decimal point
  2. Decimal point is optional
  3. Total length including decimal point should not exceed 12 char
  4. if no decimal point is there, max length should not exceed 9 char

Can anyone help me out? thanks a lot in advance.

Edit
Report