fork download
  1. import re
  2. subject = '[]{}&&& ThisIs(OK)'
  3. regex = re.compile(r'\([^)]*\)|([^a-z()]+)')
  4. # put Group 1 captures in a list
  5. matches = [group for group in re.findall(regex, subject) if group]
  6.  
  7. print("\n" + "*** Matches ***")
  8. if len(matches)>0:
  9. for match in matches:
  10. print (match)
  11.  
Success #stdin #stdout 0.03s 9440KB
stdin
Standard input is empty
stdout
*** Matches ***
[]{}&&& T
I