- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 02:38 AM
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
Result form above validation
Error popping up for correct values as well.
Thanks,
Prudhvi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 04:15 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 03:31 AM
So close - use [] instead of ()
^[a-zA-Z0-9\-]*$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 03:39 AM
Hi @Brad Bowman
Yes, I have already tried it, so the result was, It was expecting any type of expression. If I give only number only no error and system takes it as correct expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 04:07 AM
So what is your actual requirement - a certain number of alphanumeric characters PLUS a hyphen? Must/will it always be 4-4-4-4-4-4 as pictured?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 04:14 AM
My Requirement is the field should have 24 characters alphanumeric value with a hyphen after every 4 characters
Example: Ab12-CD34-fg45-Sf45-s1ft-1We4