Regex constraint to validate alphanumeric


(Narendra S Thakuri) #1

I am trying to use RegEx to validate alphanumeric value.
Constraint = “regex(.,('^[A-Z0-9]0[1-9]demogForm.xlsx (17.6 KB)
{3}$'))”


(Dr. Gareth S. Bestor) #2

Can you describe or post some examples of what strings you are trying to check. Your regex looks like a valid regex expression, but without some test cases it’s not possible to determine if it’s fit for purpose. Thnx


(Narendra S Thakuri) #3

Thanks,
I would like to check alphanumeric character ranges.
Example.
a) 001-999 Or.
b) A01-A99


(Dr. Gareth S. Bestor) #4

regex(., '^[0-9]{3}$')

regex(., '^[A-Z][0-9]{2}$')

(assuming you want to allow prefix letters other than 'A') :slight_smile:

I highly recommend hopping on somewhere like regex101.com and playing around. It’s simple to try out different regex expressions against data you type in, and finding out in real-time what does/not work is a great way to learn the seemingly indecipherable language of regular expressions.


(Narendra S Thakuri) #5

Thanks Xiphware for your help.