【发布时间】:2020-03-19 07:44:52
【问题描述】:
代码:
text = "('hel'lo') eq 'some 'variable he're'"
re.compile(r"(?<!\(|(?<=eq ))'(?!\)|\Z)").sub(string=text, repl="''")
出现错误:
re.error: look-behind requires fixed-width pattern
预期输出:
('hel''lo') eq 'some ''变量 he''re'
【问题讨论】:
标签: python regex python-3.x