如何将 sed 与扩展正则表达式一起使用:同时使用组、条件或括号字符?

How to use sed with extended regex: group, condition or and bracket character at the same time?

我想对条件或[=26=使用sed扩展正则表达式(带有选项-r) ]和括号字符是为了避免这里同时是几个意思的字符()的冲突。

例如:

(a)ccc(b)

GNU bash 中用于提取此字符串的 (a)(b) 的正则表达式是什么?

它是模棱两可的 or condition 在这种情况下,做 :

echo '(a)ccc(b)' | sed -r 's/.*(\(a\)).*(\(b\)).*/ /'