Skip to main content
Nintex Community Menu Bar
Answer

I need help with a field validation

  • May 14, 2024
  • 2 replies
  • 129 views

Forum|alt.badge.img+5

I am using New Responsive Forms.  I have a business requirement to validate/mask a text field.  I am not sure if it would be easier to use a Text Mask or Regular Expression. Below are the requirements.  Can anyone help me with this?

  • Text Field called “Board Item No”
  • Format:
    • First part is limited to 2 digits (can be 1 digit)
    • Second part is limited to 4 digits (can be 1, 2, or 3 digits)
    • First and second parts are separated by a dash (-)
  • Example of valid values
    • 7-2
    • 23-2222
    • 1-123

 

 

 

 

 

Best answer by Chris_Ben

Hi,

 

The text mask won’t work in this case because it doesn’t cater for the length of digits e.g. where you allow 1 or 2 digits before the dash.  A regular expression such as the below would do the trick though:

^\d{1,2}-\d{1,4}$

This one expects 1-2 digits then a dash then 1-4 digits.

2 replies

Chris_Ben
Nintex Employee
Forum|alt.badge.img+14
  • Nintex Employee
  • Answer
  • May 14, 2024

Hi,

 

The text mask won’t work in this case because it doesn’t cater for the length of digits e.g. where you allow 1 or 2 digits before the dash.  A regular expression such as the below would do the trick though:

^\d{1,2}-\d{1,4}$

This one expects 1-2 digits then a dash then 1-4 digits.


Forum|alt.badge.img+5
  • Author
  • Rookie
  • May 15, 2024

@Chris_Ben  - Perfect.  Thank you!