fork(1) download
  1. import re
  2. text = "('hel'lo') eq 'some 'variable he're'"
  3. print(re.compile(r"(?<!\()(?<!eq )'(?!\)|\Z)").sub(string=text, repl="''"))
Success #stdin #stdout 0.03s 9468KB
stdin
Standard input is empty
stdout
('hel''lo') eq 'some ''variable he''re'