问题
I've been playing around with the Notepad++ regular expression engine, but there's something I can't make work, it's the explicit quantifier notation.
I've seen some other posts here where the following syntax is used : (expr){1,2}
However, when I use it in a test as simple as k{1,1}
where the text to search is k : there is no match.
I tried a lot of syntax's : {1,}, {1}, etc.
Am I missing something here ?
Please excuse my bad english, and thanks for your answers !
回答1:
Starting with version 6.0, Notepad++ supports PCRE (source). Quantifiers will work as expected in these versions.
The regex engine of Notepad++ 5.9.8 and lower does not support quantifiers (source).
You can, however, use the following quantifiers:
k*, which is equivalent tok{0,}.k+, which is equivalent tok{1,}.k?, which is equivalent tok{0,1}.
If you want other quantifiers, you can combine the above methods.
Examples:
kkk+emulatesk{3,}kkkk?k?emulatesk{3,5}
回答2:
Notepad++'s regular expression system does not appear to support that feature. They do support k+ and k*.
来源:https://stackoverflow.com/questions/7924286/notepad-explicit-quantifier-notation