Conditions:-
- Total length = 12
- First letter = A
- Second letter = B
- Rest of the 10 characters = Numbers or alphabets
- Rest of the 10 characters cannot be equal to 0000000000
Valid:-
- AB1234567890
- ABABABABABAB
- AB1234HIJ001
Invalid:-
- AB0000000000
- AB0
- AA1234567890
I have come up with this regex: '^[A-A][B-B][A-Z0-9]{10}$'
. It prevents Invalid #2 and #3. But I'm having a hard time with Invalid #1. I know that to prevent all characters from being 0, I need to use '^0+$'
. But how do I combine these two expressions?