Checking that a 6-digit number is not repeated and not in sequence
I would write a separate function for validating a string (so that it has a name and you can talk about it).

Then, I would not use regular expressions for it but just simple code:


The length must be 6.
Only digits are allowed.
For each pair of adjacent digits, their difference must be at least 2.


That should be much easier to understand than your regular expression.