Validation Regex for Numbers and as well allows decimal values ?

Deepika61
Tera Contributor

Hi All,

Actually we have Validation regex for Numbers (integers), it allows only integers, but my requirment was, along with numbers , if user wants to allows him to add decimal value it , so The Regex allows him that able to integers or able to decimal values to integers also?

 

The Validation regex as we have 

^[0-9]*$

please help me to complete this

 

Thanks

Deepika

2 REPLIES 2

Gurpreet07
Mega Sage

Hi Deepika,

 

Please try below

^[1-9]\d*(\.\d+)?$

Abbas_5
Tera Sage
Tera Sage

Hello @Deepika61,
Please refer to the below link:
https://www.servicenow.com/community/developer-forum/regex-for-decimal-validation/m-p/2103267

 

Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik