0

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?

2
  • 1
    Can you post a couple of good and bad string examples? Commented Apr 13, 2017 at 4:05
  • Is that any unicode lower case or a-z? Commented Apr 13, 2017 at 4:11

1 Answer 1

1

I think you need this:

^[0]{3}[a-zA-Z]{,4}\-[a-z0-9]{8}\-((ab)|(cd)|(kys))$
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.