I need a regex pattern to match a sequence of 3 consecutive digits in a string that are consecutively increasing or decreasing.
For example:
These strings should match (xxx123xxx, 789xxxxxx, xxxxxx987, xxxxxx432)
These strings should not match (xxxxxx454, 333xxxxxx, xxx429xxx)
There is no other way than listing them:
(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With