alienmode
alienmode

Reputation: 59

Multiple regular expressions in python to check string

I am trying to write a regular expression statement that checks a string meets the following:

begins with three zeros, is followed by up to four letters, is then followed by a dash, is followed by eight characters that are lower case letters or digits, another dash, then a suffix that is either ab cd or kys.

^[0]{3}[-](?=.*?[a-z])(?=.*?[0-9]).{8,}[-]([ab][cd][kys])

I'm a little confused on how I should be breaking up the eight charaters portion and the suffex portion. Can someone point me in the right direction?

Upvotes: 0

Views: 40

Answers (1)

Ahasanul Haque
Ahasanul Haque

Reputation: 11134

I think you need this:

^[0]{3}[a-zA-Z]{,4}\-[a-z0-9]{8}\-((ab)|(cd)|(kys))$

Upvotes: 1

Related Questions