I need a regular expression to match a string as follows:
- Length 8
- Start with number 4 or 6
- The remaining characters can be 7 numbers OR 6 numbers with an x at the end
e.g.
- 41234568
- 4123456x
- 4234234X
- 62432434
- 6243243x
I have the following but it doesn't work for 62432434 or 41234568
^((4|6)([0-9]{6,7})(X|x))$
