Why doesn't this regex work in Notepad++ (Windows)?

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

The following regex works when I test it here: https://regex101.com/r/oxsNRW/2

(toString\(\)[\s\S]+\))(\s*\R\s*?})

However, when I put the same input and regex into Notepad++ on Windows 10 it says the regex is invalid. Why?

回答1:

Notepad++ regex flavor is Boost, and its regex syntax is a bit different from PCRE.

In your case, escape the }:

(toString\(\)[\s\S]+\))(\s*\R\s*\})                                 ^^



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