Let's say I have a string that can contain only A's, B's and C's.
I have substrings of a certain pattern that I want to extract: they start with ABC, continue with a combination of B's and C's, and end with CBA.
The naive solution is to use ABC[BC]*CBA
.
However, that will not cover the ABCBA
string. Is there a "pythonic" way to address this, other than using |
to look for two possible RE's?