user1494459
user1494459

Reputation:

To restrict to only Upper-case or Lower-case letteres

I have this regular expression

^(?:0[0-9]|1[0-3])-ARID-[0-9]{3}$

but it matches only strings like 10-ARID-278 but I want to that it should accept strings like 10-arid-257 too.

And not the strings like 10-Arid-257 or 10-ARid-257

The literal should be either ARID or arid, not the mix of upper and lower-case.

Upvotes: 0

Views: 132

Answers (1)

falsetru
falsetru

Reputation: 368954

Explicitly list both uppercase and lowercase word, combining them using | (meaning OR).

^(?:0[0-9]|1[0-3])-(?:ARID|arid)-[0-9]{3}$

Upvotes: 3

Related Questions