Sandeep Kumar6
Giga Guru

Thanks to Mark Roethof 🙂

                                                        find_real_file.png

As we are using Madrid or NewYork version of ServiceNow. I have come across one OOB feature of ServiceNow in Madrid for validating  below

Currency || Email || IP address || Letter || Mac address || Number || URL

We have a table in ServiceNow called  Questions Regular Expression “question_regex”. Which store the regular expression in record format. See below.

find_real_file.png

OOB we only three validation but we can create as many as we want with the help of  Regex.

Once we create a record in Questions Regular Expression “question_regex” table we can put that validation while creating variable in Catalog item.

See below: This works on Single line text field.

find_real_file.png

No more writing lengthy script for validation.

Below are the Regex validation we can utilize 

- Currency ($)
^\$[0-9]*\.[0-9]{2}$
- Currency (€)
^\€[0-9]*\.[0-9]{2}$
- Email address
^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
- IBAN
^[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}$
- IP address
^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$
- Letter (A-z)
^[A-Za-z]*$
- Mac address
^[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}$
- Zip Code (NL)
^[1-9][0-9]{3}[\s]?[A-Za-z]{2}$

Reference : 

https://community.servicenow.com/community?id=community_article&sys_id=78785137dbcbf3801cd8a345ca961...

More details on similar topic I have kept in portal  - https://www.servicenowpreparation.com/ you can visit.

Happy Learning

Many Thanks to Mark Roethof (https://community.servicenow.com/community?id=community_user_profile&user=e5cf8aeddb181fc09c9ffb651f...) for the knowledge.

 

Regards

Sandeep Kumar

 

Version history
Last update:
‎03-03-2020 12:57 AM
Updated by: