How to allow numbers and decimals in string

pramodkumar
Tera Expert

Hi All,

How can we create regex to allow numbers and decimals in string variable.

For ex: 1234, 12334.89

 

 

Thanks!

5 REPLIES 5

RaghavSh
Kilo Patron

There is already a regex in service now OOB instance for this, you just need to use that.

 

Refer :https://www.servicenow.com/community/developer-forum/how-to-make-a-variable-in-catalog-form-to-accep... 


Raghav
MVP 2023

@pramodkumar Did you get your issue fixed?


Raghav
MVP 2023

@pramodkumar did this work for you?


Raghav
MVP 2023

Vishal Birajdar
Giga Sage

Hi @pramodkumar 

 

You can create regex as below screenshot. 

 

VishalBirajdar_0-1697458358150.png

 

and use that regex in single line text variable :

 

VishalBirajdar_1-1697458422605.png

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates