Hello!
I'm trying to set up a regex validation between 6-7 characters that could be either numbers or letters, I was trying to work with this code:
[a-zA-Z0-9]{6,7}
But the code isn't validating, it's letting anything in. Can someone let me know what's wrong with the above?
Page 1 / 1
You are not enforcing a string length, therefore, even if the text is 100 chars long, as long as it had a sequence of 6 or 7 letters and numbers, it'll pass.
Add the start of and end of string tokens to get it to work:
^[a-zA-Z0-9]{6,7}$
https://www.qualtrics.com/community/discussion/comment/36022#Comment_36022Thank you so much, that seemed to do the trick! So putting ^ at the beginning and $ at the end is what's enforcing the {6,7}?
Yes. You can read more and even tryout things here: regex101.com
https://www.qualtrics.com/community/discussion/comment/36039#Comment_36039Perfect! Thank you so much for your help
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.