vendredi 21 juillet 2017

Regex IF/Then expression with required characters

I'm quite new to regex and very much stuck with the following expression. I'm looking for a regex code that allows the following combinations:

AA1A 1AA AA 12 A 12 A 1

Requirements:

  • String can not start with a number
  • Only capital letters (A-Z)
  • 1 space is required at predetermined places (see above examples)
  • Numbers 0-9 can be used

I am currently working on/with the following string ([A-Z]{1,2}|[A-Z0-9]{1,4})([ ]{1})([0-9A-Z]{1,3})

The issue with this one that it does not allow the AA1A 1AA string..

Any ideas? Thank you!

Aucun commentaire:

Enregistrer un commentaire