What's a Regex pattern for 3 consecutive digits increasing or decreasing -


I need a regex pattern to match the successive 3 digit sequence in a rising or decreasing string. For example:

These strings must match (xxx123xxx, 789xxxxxx, xxxxxx987, xxxxxx432)

These strings must not match (xxxxxx454, 333xxxxxx, xxx429xxx)

There is no other way than to list them:

  (012 | 123 | 234 | 345 | 456 | 567 | 678 | 789 | 987 | 876 | 765 | 654 | 543 | 432 | 321 | 210]  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -