Skip to content

Commit 067a3de

Browse files
authored
Update README.md
1 parent 3ea2ec1 commit 067a3de

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • Client-Side Components/Catalog Client Script/Regex Validation

Client-Side Components/Catalog Client Script/Regex Validation/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@
33
*****************
44
8th october:
55
This script will validate valid Adhaar number.
6-
Adhaar is a 12 digit unique identification number issues by UIDAI in India for Indian Residents.
6+
Adhaar is a 12 digit unique identification number issues by Unique Identification Authority of India (UIDAI) for Indian Residents.
77
The script will validate Adhaar through regex and if it is not valid, variable is cleared with field message.
8+
For Catalog variables Preferred OOB method is listed here : https://www.servicenow.com/docs/bundle/xanadu-servicenow-platform/page/product/service-catalog-management/task/define-regex-vrble.html . The same regex can be defined in "Variable Validation Regex" module.
9+
For Normal fields, this entire scriopt can be used.
10+
11+
Regex details :
12+
/^[2-9][0-9]{3}[0-9]{4}[0-9]{4}$/
13+
// ^ → Start of the string
14+
// [2-9] → The first digit must be between 2 and 9
15+
// [0-9]{3} → Followed by exactly 3 digits (0–9)
16+
// [0-9]{4} → Followed by exactly 4 digits (0–9)
17+
// [0-9]{4} → Followed by exactly 4 digits (0–9)
18+
// $ → End of the string
819

920
*****************
1021
With the help of this code you can easily validate the input value from the user and if it's not a email format you can clear and throw a error message below the variable. Of course you can use Email type variable as well but you cannot have a formatted error message.

0 commit comments

Comments
 (0)