Regular Expression for matching a numeric sequence?
regex
Solution
Here it is:
^(0123|1234|2345|3456|4567|5678|6789|3210|4321|5432|6543|7654|8765|9876|0000|1111|2222|3333|4444|5555|6666|7777|8888|9999)$
Problem
Does anyone know of a regular expression for matching on a sequence of four digits? I need a match on ascending (1234), descending (4321), or the same (1111). This would be strictly ascending/descending; 1357 shouldn't match.