I need to match numbers in groups of 5, from 1 to 5, with the following exceptions:
- Numbers can't include zeros
- Numbers can't be like 11111, 22222 and so on.
- Numbers can't be like 12345 or 54321
Some examples of valid numbers:
14252, 45121, 43412, 51321 ...
So far I got an expression to group the numbers and do not allow zeros.
But I'm having some trouble to handle the second and third exceptions. I tried unsuccessfully to use a negative lookahead to disallow a match if I have a pattern of repeated numbers.
I'm trying with this expression:
How can I write regular expressions to not match certain patterns?
I will eventually change it to not match any other sequence of numbers.