import re pattern = r"[#@&$]a[#@&$](?<!@a\$)"print(re.findall(pattern,'something#a&others@a$'))
Standard input is empty
['#a&']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!