import re s = 'ACAABAACAAABACDBADDDFSDDDFFSSSASDAFAAACBAAAFASD'pattern = r'[B-Z](?=AAA)'result = re.findall(pattern, s) print(result)
Standard input is empty
['C', 'F', 'B']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!