Custom Validation Rule

Follow

Note: If your screen looks different than the one below, click here.

 

 

You can enter a custom regular expression if we don't have the one that you need for your field. Below are some examples:

 1 to 5 digits

 Expression

 ^(\d{1,5}$

 Matches

 1 | 11| 111 | 1111 | 11111

 Non-Matches

 a | 111111 

 4 digits

 Expression

 ^(\d\d\d\d)$

 Matches

 1111| 2222| 1234 

 Non-Matches

 aaaa| 1 | 11111

 Value 1 to 9

 Expression

 ^(1-9)$       

 Matches

 1| 2 | 9 

 Non-Matches

 a| 0 | 11 

 At least 5 characters

 Expression

 ^(\D{5,}$

 Matches

 aaaaa | aa11aa| 11111 | 1111111111 

 Non-Matches

 a | aa |aaaa | 1111

 4 upper case characters

 Expression

 ^([A-Z]{4})$

 Matches

 AAAA | BBBB | 111 | 1111 | 11111

 Non-Matches

 aaaa | 1111 | AAA1 |  

 US Zipcode

 Expression

 ^(\d{5})$         

 Matches

 11111 | 12345| 45400

 Non-Matches

 abcde | 11111 | 11111-1111

 US Zipcode+4

 Expression

 ^([0-9]{5}(([-])?){1})+([0-9]{4})$

 Matches

 11111-1111 | 22222-2222

 Non-Matches

 11111-11111 | 111111 | 2

 US Social Security Number   

 Expression

 ^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$

 Matches

 078-05-1120 | 078 05 1120 | 078051120

 Non-Matches

 987-65-4320 | 000-00-0000 | (555) 555-5555

 

To test your regular expression and learn more, visit: http://www.rubular.com

Have more questions? Submit a request

Comments

Powered by Zendesk