In this example:
("Talking with Bengt Holmstrom 1" "#44")
("Chapter 1 What is Economics? 3" "#46")
开发者_StackOverflow
, which is matched by regex ^(?!.*(Chapter|Part)).*\n\("Chapter.*\n, I would like to
have two groups ("Talking with Bengt Holmstrom 1" "#44") and ("Chapter 1 What is Economics? 3" "#46").
To group, the above regex is modified to be^((?!.*(Chapter|Part)).*)\n(\("Chapter.*)\n. I want to refer to the two groups, but using \1 and \2 as their references as in \1\2 doesn't work. I was wondering if anything is wrong?
BTW, I am using gedit regex plugin.
Thanks!
Just refer to them as \1 and \3.
Just count the opening ( as you go from left to right. 1) is ((?!.*(Chapter|Part)).*), so the first line. 2) is (Chapter|Part) 3) is ("Chapter.*), so the second line starting with "Chapter.
Note that the ( that is the beginning of the lookahead is not counted.
加载中,请稍侯......
精彩评论