Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restict the value

chandan31
Tera Contributor

Hi All ,

 

I  need to create regex to restrict the value from 0 to 30.0 . but it should not allow more than 30.1 . that field is numeric value 

Thanks,

Chandan

1 ACCEPTED SOLUTION

As said, before... please share your script if it's not working. This regex is correct for what you asked Only allow for values 0 until (and including) 39.0

 

PeterBodelier_0-1702050743145.png

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

8 REPLIES 8

Niklas Peterson
Mega Sage

Hi,

Test this regex:
^(?:30(\.0)?|2?[0-9](\.[0-9])?|1?[0-9](\.[0-9])?|0?(\.[0-9])?)$

 

Regards,
Niklas

form is not saving in the on load client scripts, by mistake i have given 0 to 30.1 but it should be 0 to 39.0

Then the regex is 

/^(?:39(\.0)?|2?[0-9](\.[0-9])?|1?[0-9](\.[0-9])?|0?(\.[0-9])?)$/

 

If your script is not saving, please share the complete script.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

from 30 to 39  , it is not allowing