且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Notepad++ 非贪婪正则表达式

更新时间:2022-11-12 09:58:49

注意:此已接受的答案自 2011 年 3 月 31 日起已过时.Notepad++ v5.9 及更高版本现在支持非贪婪的正则表达式.

请在此处此处.


Notepad++ 不支持惰性 ? 修饰符.相反,您可以指定您想要的内容:

NOTE: This accepted answer is obsolete as of March 31, 2011. Notepad++ v5.9 and higher now support non-greedy regular expressions.

Please see an updated answer here or here.


Notepad++ doesn't support the lazy ? modifier. Instead, you can specify what you don't want:

a[^c]+c

指定:匹配a,后跟一个或多个不是c的字符,后跟c.这将匹配 abcadc.

Which specifies: match a, followed by one or more character that isn't c, followed by c. This will match abc and adc.