Regex Validation Question | XM Community
Skip to main content
Edit: I realized that the validation does not activate until the participant attempts to move to the next page. Solved!



Hello,



I have a survey that requires the participant to self-generate a unique identifier code. The must use their fathers first and middle initials, followed by their mother's maiden name first initial, 2-digit date of birth and 2-digit year of birth. An example of a correct code would be NES2096. It doesn't matter if the letters are capitalized or not, but it must be three characters followed by four digits with no spaces or dashes.



I think the Regex code I need is something like ^[A-Za-z]{3}[0-9]{4}$



I have the question set up as a single-line text entry with force response and with custom validation Question > Choice > Matches Regex > ^[A-Za-z]{3}[0-9]{4}$ and an error message if the validation fails; however, when I test this question on Preview mode (ignore validation setting is unchecked) it continues to the next question regardless of the response that I enter into the box.



This is my first time using Regex. Can anyone help?
Try this Regex:

^[A-Za-z]{3}\\d{4}$

Leave a Reply