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

后端 未结 3 1806
情话喂你
情话喂你 2020-12-19 12:59

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 sh

3条回答
  •  温柔的废话
    2020-12-19 13:58

    This can be done simply, but only with defining the valid sets of consecutive digits

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

提交回复
热议问题