正则表达式,仅从多行文本中选择第一个子字符串

时间:2019-03-22 11:04:54

标签: regex notepad++

我需要在记事本++中替换多行子字符串

文字:

some text-123 first time occurrence1
blah-blah-blah some other text
-blah end of selection1 abc
-blah-blah 123 second time occurrence2
blah-blah-blah
-blah-blah end of selection2 def
some other text

因此,我需要选择:

123 first time occurrence1
blah-blah-blah some other text
-blah end of selection1 abc

但正则表达式

(?im)123 [\S\s]*end of.*$

选择

123 first time occurrence1
blah-blah-blah some other text
-blah end of selection1 abc
-blah-blah 123 second time occurrence2
blah-blah-blah
-blah-blah end of selection2 def

我如何只选择第一次出现,“第二次出现2”除外?

0 个答案:

没有答案