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

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 regular expression in Notepad ++ on Windows 10, it says that the regular expression is not valid. Why?

+4
source share
1 answer

The source code is Notepad ++ regex Boost , and its regex syntax is slightly different from PCRE.

In your case, remove }:

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

enter image description here

+4
source

Source: https://habr.com/ru/post/1668308/


All Articles