REGEX password validation

4

I have a validation problem and I can not apply within a simple structure, 3 validations can not have alphanumeric decreasing, increasing or repeated in a same password.

  

For example: 00000000, 01234567, 98765432, aaaaaaaa, aa1123456

Can anyone help me?

    
asked by anonymous 28.07.2016 / 17:12

1 answer

1

As far as I know, it is not feasible to detect sequence numbers with regex . You can easily detect repeated characters, such as 000 or aaa, but a 123, 987 or abc sequence.

The regex by itself, does not assign value to the characters. It does not identify that 2 is greater than 1 or that b is followed by a in the alphabet. To do this you would have to write every possible sequence for it to give match on any of them. As an example the pattern " 123|12|23|321|32|21 " to identify a simple sequence between three numbers.

For repeated letters or numbers you could use a pattern that looks for repeated occurrences like " (\d|\w)+ ". In this case, the pattern gets a letter or number and then checks to see if it repeats one or more times. See working at regex101 .

    
28.07.2016 / 18:40