I'm trying to match strings that either:
- Contains between 9 and 15 numbers (Only numbers)
- Contains between 6 and 15 numbers+letters (it must contain both, numbers and letters. Only letters is not a valid option).
I have the following regex: \b([0-9]{9,15})|([A-Za-z0-9]{6,15})\b
which fails because the second part allows you to have a string with 6 numbers or 6 letters only.
Should be valid:
- 123456789
- 12345678Y
- Y234Y2
Should not be valid:
- 12345678
- 123X4
- ABCDEFGHYJ