I'm trying to match words with letters that have some constant alphabetical distance between them, for example, I'd like to find all words with A.*B
, B.*C
, C.*D
, etc. I'm currently using the 're' package in Python 3.
Is there some way to do this without specifying all tuples of letters of distance 1 apart? I.e. not (A.*B|B.*C|C.*D|....|Y.*Z)
.
I'm looking for some robust solution which will work in more complex cases which require many groups (if it even exists).