问题
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