gro*_*vel 3 regex notepad++ negative-lookbehind negative-lookahead
我是正则表达式的相对新手(尽管我已成功使用它们多次).我想在文档中找到所有不以".html"结尾的链接我提出的正则表达式是:
href=\"([^"]*)(?<!html)\"
Run Code Online (Sandbox Code Playgroud)
在Notepad ++中,我的编辑器href=\"([^"]*)\"
找到所有链接(包括以"html"结尾的链接和不以"html"结尾的链接).为什么不负面的背后工作呢?
我也尝试过前瞻:
href=\"[^"]*(?!html\")
Run Code Online (Sandbox Code Playgroud)
但那也不起作用.
有人可以帮忙吗?
干杯,gro ..
如果您使用PERL或PCRE(例如PHP中的preg_match),那么正则表达式将正常工作.但是,大多数人都不支持前瞻和后瞻断言,特别是更简单的正则表达式引擎,就像Notepad ++使用的那样.几乎所有正则表达式引擎都只支持最基本的语法,如量词,子模式和字符类.
您可以在以下位置找到notepad ++正则表达式引擎的文档:http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title =Regular_Expressions