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

て烟熏妆下的殇ゞ 提交于 2020-01-03 17:09:10

问题


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*\})
                                ^^



来源:https://stackoverflow.com/questions/41945175/why-doesnt-this-regex-work-in-notepad-windows

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