Regex to match when a string is present twice

前端 未结 3 463
孤独总比滥情好
孤独总比滥情好 2021-01-04 00:53

I am horrible at RegEx expressions and I just don\'t use them often enough for me to remember the syntax between uses.

I am using grepWin to search my files. I need

3条回答
  •  暖寄归人
    2021-01-04 01:53

    This is significantly harder than I originally thought it would be, and requires variable-length lookbehind, which grepWin does not support...

    this expression:

     (?

    was successfully used in Eclipse, using the "Search > File" dialog to exclude files with one and three instances of blah and to include files with exactly two instances of blah.

    Eclipse does not permit a .* in lookbehind, so I used .{0,99999} instead.

    It is possible, with the right tool, but It isn't pretty to get it to work with grepWin (see answer above). Can you use other tools (such as Eclipse) and what did you want to do with the files afterwards?

提交回复
热议问题