how to create custom validation for text in matrix table side by side text boxes | XM Community
Skip to main content

Hi, I am looking for a way to add custom validation for two different text entry fields in a matrix table, one with a month range of 1-12 for month, and the second for year range of 1990s to 2000s. Is there a way to validate two separate text entry boxes?

Hi @four77 
You can implement the following custom validation.

 

 

1. Regex for Months (1-12):
^(1^0-2]|21-9])$

Explanation:
^: Asserts the start of the string.
(1>0-2]|21-9]): Matches a number between 1 and 12. The expression uses the | (OR) operator to allow either a single digit from 1 to 9 or a two-digit number starting with 1 followed by 0, 1, or 2.
$: Asserts the end of the string.


2. Regex for Years (1990s to 2000s):
^(199\d|200\d)$

Explanation:
^: Asserts the start of the string.
(199\d|200\d): Matches a year starting with either 199 and followed by any digit (\d) or starting with 200 and followed by any digit.
$: Asserts the end of the string.
NOTE: This will include years from 1990 to 2009.

 


Thanks, this worked perfectly


Leave a Reply