Using python, I am trying to identify strings that verify the following conditions:
- It must contain 9 characters
- Characters 2 to 8 must be numbers
- Characters 1 and 9 can be numbers or letters (lower or upper)
- Characters 1 and 9 can't be both numbers.
For example, 'A12345678', '01234567A' and 'A1234567B' will match, but '012345678' will not match.
For conditions 1 to 3 I use '([a-z]|[A-Z]|[0-9])[0-9]{7}([a-z]|[A-Z]|[0-9])$'. For condition 4 I use '(?![0-9]{9}$)'. However, I don't know how to join those conditions in a unique regex. Can somebody help me? Thanks in advance!