Regex Numeric

(5,2):   ^\d{1,3}(,\d{1,2})?$
(6,2):   ^\d{1}(\.\d{3}){1}|(\d){1,4}(,\d{1,2})?$
(7,2):   ^(\d{2}(\.\d{3}){1}|(\d){1,5})(,\d{1,2})?$
(13,2): ^(\d{1,2}(\.\d{3}){3}|\d{1,3}(\.\d{3}){0,2}|(\d){1,11})(,\d{1,2})?$
(10,2): ^(\d{1,2}(\.\d{3}){2}|\d{1,3}(\.\d{3}){0,1}|(\d){1,8})(,\d{1,2})?$
(19,4): ^(\d{1,2}(\.\d{3}){4}|\d{1,3}(\.\d{3}){0,4}|(\d){1,15})(,\d{1,4})?$

If this regex is used to validate textfield input and is allowed to be null:
just add “\s*” in front of the regex.
ex:
(5,2):   ^(\s*|[0-9]{1,3}(,[0-9]{1,2})?)$
(10,2): ^(\s*|(\d{1,2}(\.\d{3}){2}|\d{1,3}(\.\d{3}){0,1}|(\d){1,8})(,\d{1,2})?)$

   Newer→