After googling many days about the issue, finally I am posting this question here and hoping to get it solved by experts here; I am looking for the regex pattern that can match incremental back references. Let me explain:
For number 9422512322
, the pattern (\d)\1
will match 22
two times, and I want the pattern (something like (\d)\1+1
) that matches 12
(second digit
is equal to first digit + 1
)
In short the pattern should match all occurrence like 12
, 23
, 34
, 45
, 56
, etc... There is no replacement, just matches required.