Validating a Form Control with Regular Expression

  • 15 February 2022
  • 0 replies
  • 1028 views

Userlevel 5
Badge +19

Topic

If there is a requirement  to enforce formatting or prevent special characters in a form control, leveraging Regular Expression may be the most efficient option.

 

Instructions

  1. Select the control.
  2. Open “Control settings”.
  3. Go to the "Validation" group.
  4. Set "Use Regular Expression" to 'Yes'.
  5. Enter the desired expression
For example:
Prevent Special Characters (Allow alphanumeric characters only)
w+

Email Address Format:
^[A-Za-z0-9](([_.-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([.-]?[a-zA-Z0-9]+)*).([A-Za-z]{2,})$

 

 

Additional Information

Configuring validation within the control settings is the only way to leverage Regular Expression for validation at runtime in a Nintex Form. Using a Validation Rule with runtime functions will not properly evaluate Regular Expression. For example, using the contains() function to attempt to prevent special characters only evaluates literal strings rather than Regular Expressions.

 

Related Links

Microsoft - Regular Expression Language - Quick Reference
Regular Expression Language - Quick Reference

 


0 replies

Be the first to reply!

Reply