在这个例子中:
("Talking with Bengt Holmstrom 1" "#44")
("Chapter 1 What is Economics? 3" "#46")
,由正则表达式匹配^(?!.*(Chapter|Part)).*\n\("Chapter.*\n
,我想要两组("Talking with Bengt Holmstrom 1" "#44")
和("Chapter 1 What is Economics? 3" "#46")
。
为了分组,上面的正则表达式被修改为^((?!.*(Chapter|Part)).*)\n(\("Chapter.*)\n
. 我想引用这两个组,但是像 in 那样使用\1
and\2
作为他们的引用是\1\2
行不通的。我想知道有什么问题吗?
顺便说一句,我正在使用 gedit 正则表达式插件。
谢谢!