The ReGex pattern allows us to implement Validation into your Text Field. Validation allows you to restrict what data is put into your Text box. For instance, we can restrict the user to characters ranging from A to H or to lowercase characters exclusively etc.
Some Common Examples:
Alphanumeric without Spaces
/^[a-zA-Z0-9]*$/
Whole Numbers
/^\d+$/
UpperCase Letters with white space
[A-Z\s]+
LowerCase Letters with white space
[a-z\s]+
Colour HexCode
Colour Hexcode "^#(?:[0-9a-fA-F]{3}){1,2}$
For a more detailed explanation of Regex a suggested article is:
https://www.regular-expressions.info/quickstart.html
Use Case Examples
Match Any Email Address from a Specific Domain | |
Usage Example | Match any email address from the domains hotmail.com, and gmail.com. |
Regex | (\W|^)[\w.\-]{0,25}@(hotmail|gmail)\.com(\W|$) |
Notes |
|
Match Word or Phrase |
|
Usage Example | Match any word or phrase in the following list:
|
Regex | (?i)(\W|^)(Softools|Gridfields|Zero\sCode)(\W|$) |
Notes |
|
Comments
0 comments
Please sign in to leave a comment.