fork download
  1. import re
  2. texts = [ 'AWS certification ( AWS Solutions Architect', 'AWS certification ( AWS Solutions Architect )']
  3. for text in texts:
  4. print( re.sub(r'(\([^()]*\))|[()]', lambda x: x.group(1) or "-", text) )
Success #stdin #stdout 0.02s 9380KB
stdin
Standard input is empty
stdout
AWS certification - AWS Solutions Architect
AWS certification ( AWS Solutions Architect )