Dear Experts,
I want to restrict a word from Input.
For example,
Allow Input: 1001A0, 1002B1, 1003D3 etc (Allow input A-Z except for C)
Restrict Input: 1001C0
Thanks in Advanced
Dear Experts,
I want to restrict a word from Input.
For example,
Allow Input: 1001A0, 1002B1, 1003D3 etc (Allow input A-Z except for C)
Restrict Input: 1001C0
Thanks in Advanced
Welcome back to the community, @tanzilhuda! So, your requirement is something like a code where users are able to input the following:
So the code should have a total of 6 characters (both integer and alphabets)?
Absolutely Yes. Would you help me with how can I write the code?
Should the first digit be 1
by default or could it be anything else?
Yes, first digit will be β1β by default.
OK, this regex code should help you solve your issue:
regex(., '^[1][0-9]{3}[(A-B)|(D-Z)][0-9]{1}$')
For details, please feel free to visit our support article Restricting Text Responses With Regular Expressions.
Dear BOSS,
Itβs working amazingly. Thank you so much. But if I want to use β^β what code will be?
Regards
Try using it inside the [ ]
as [^]
in one of the numbers.
I write this code: regex(., β^[1][0-9]{3}[(A-Z)^C][1-9]{4}$β)
But it is not working. Would you help me how can I write the code using β^β
OK, try using this regex code:
regex(., '^[1][0-9]{3}[^C][1-9]{4}$')
I write your code: regex(., β^[1][0-9]{3}[^C][1-9]{1}$β)
It is working amazingly. Thank you so much.
Beware that:
So if I am not mistaken, the right formula is the first that @Kal_Lam suggested, or this simplified variant:
^1[0-9]{3}[A-B|D-Z][0-9]$