【发布时间】:2015-01-23 19:35:09
【问题描述】:
我试图使用regsub 将所有未转义的" 替换为}。我得到了以下内容。
% set st {hello "hi this athat afsd\" adsfasdf"}
% regsub -all {(?!\\)\"} $st \}
hello }hi this athat afsd\} adsfasdf}
我想要的是
hello }hi this athat afsd\" adsfasdf}。请让我知道出了什么问题。
【问题讨论】:
-
试试这个正则表达式
(?<!\\)\",然后用}替换匹配的字符 -
@AvinashRaj 错误:
couldn't compile regular expression pattern: quantifier operand invalid