vendredi 19 juillet 2019

JAVA regex pattern if statement

^[abceghj-prstw-z][a-np-z]$

I have created this regex pattern with this requirements: First position can be any letter but d,f,i,q,u,v. Second position can be any letter but o.

I have to add somehow this: The first and second position can't be BG, GB, NK, KN, TN, NT, ZZ.

So for example string "ap" = true. "ao" = false (because second position is 'o')

I am pretty new with regular expressions so any help would be great. Thanks.

Aucun commentaire:

Enregistrer un commentaire