Open zufuliu opened 5 years ago
Multiline regular expressions is not build by default, REGEX_MULTILINE
macro is is undefined on build.
C++ regular expressions also not build by default, from https://en.cppreference.com/w/cpp/regex/syntax_option_type, C++ regex support ECMAScript, POSIX, extended POSIX, awk, grep and egrep style regex, which is attractive.
VC runtime support multiline regexp (with \n
line endings):
#include <iostream>
#include <regex>
int main(void) {
std::string doc(
"begin xxx\n"
"stmt\n"
"end xxx\n");
std::regex re(R"(^begin\s+\w+[\s\S]+end\s+\w+$)", std::regex::ECMAScript);
std::smatch m;
if (std::regex_search(doc, m, re)) {
for (auto x : m) {
std::cout << "[" << x << "]" << std::endl;
}
} else {
std::cout << "no match" << std::endl;
}
return 0;
}
Need build Scintilla with C++11 regex and REGEX_MULTILINE, and replace SCFIND_POSIX
with SCFIND_CXX11REGEX
(add a new option) in Find and Replace dialog.
I look forward to the release of a test build.
The multiline regex doen't support \r\n
(CR+LF) line endings, which may not useful.
[For bookmark purpose] "A comparison of regex engines" on https://rust-leipzig.github.io/regex/2017/03/28/comparison-of-regex-engines/
看到 Notepad3 已经实现了多行正则匹配,期待 Notepad2 加上这个~
不能直接换正则表达式引擎吗,VScode的就很好用,Notepad2的总是怪怪的。
See https://github.com/XhmikosR/notepad2-mod/issues/148.