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.

Validation Regex is not working

Prudhvi Raj4
Tera Guru

Hi Team,

 

I have created a Validation Regex for the one of the single line text variable, but it was giving error when I enter the correct expression as well. I am checking for alphanumeric with hyphens in between. Below is the code using.

  Validation Regex

PrudhviRaj4_0-1674642977557.png

Result form above validation

PrudhviRaj4_1-1674643023830.png

Error popping up for correct values as well.

 

Thanks,

Prudhvi

1 ACCEPTED SOLUTION

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Prudhvi Raj4 ,

Please try below regex

^(?:[A-Za-z0-9]{4}-){5}[A-Za-z0-9]{0,4}$

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

5 REPLIES 5

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Prudhvi Raj4 ,

Please try below regex

^(?:[A-Za-z0-9]{4}-){5}[A-Za-z0-9]{0,4}$

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy