Notepad++ explicit quantifier notation

非 Y 不嫁゛ 提交于 2019-12-19 07:18:33

问题


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 to k{0,}.
  • k+, which is equivalent to k{1,}.
  • k?, which is equivalent to k{0,1}.

If you want other quantifiers, you can combine the above methods.

Examples:

  • kkk+ emulates k{3,}
  • kkkk?k? emulates k{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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!