I have a text entry question which needs to have the following format:
-it needs to be exactly 6 characters long
-The first character can only be one of the letters p,m.l,k,n (both uppercase and lowercase are fine)
-The second character can only be a number
-The next three can only be letters (any letter, uppercase or lowercase)
-The last one has to be a number.
How can I set this on the survey platform?
Best answer by omkarkewat
Hi @avantika23 You can use custom validation in the text entry question and set condition as matches regex = ^[pmlk'nPMLK'N]\d[a-zA-Z]{3}\d$
Explanation of the regex:
^: Asserts the start of the string. [pmlk'nPMLK'N]: Matches one of the specified letters (p, m, l, k, n, P, M, L, K, N). \d: Matches a digit (0-9). [a-zA-Z]{3}: Matches three letters (any case). \d: Matches another digit. $: Asserts the end of the string.
Hi @avantika23 You can use custom validation in the text entry question and set condition as matches regex = ^[pmlk'nPMLK'N]\d[a-zA-Z]{3}\d$
Explanation of the regex:
^: Asserts the start of the string. [pmlk'nPMLK'N]: Matches one of the specified letters (p, m, l, k, n, P, M, L, K, N). \d: Matches a digit (0-9). [a-zA-Z]{3}: Matches three letters (any case). \d: Matches another digit. $: Asserts the end of the string.