Skip to Content

Regex to allow max 10 digits followed by only one comma and 3 more digits


i trying to validate entered data into input control on live change.

Input control should accept max 14 characters - 10 digits followed by comma and 3 more digits.

For example: 1234567890,657

There has to be only one comma, another comma should not be allowed.

I tried the following code:

var enteredVal = oEvent.getParameter("value");
var filteredVal = enteredVal.replace(/[^\d+(,{1}\d{3})?$]/g, '');

I am able to enter only digits and comma upto 14 characters as the max length of control is set to 14.

Comma can come at any position, but after comma max 3 digits are allowed.

Few more examples:




How do i restrict second occurrence of comma and restriction digits after comma.

Please suggest possible options.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers