Open TheEpicFace007 opened 3 years ago
Thank you for this example code.
Please see https://github.com/firasdib/Regex101/wiki/Writing-a-Code-Generator on how to help us implement this code generator.
FYI: I believe that std::regex
in c++ only does POSIX? Would it be worth to have an example using something like Boost or similar very common library that actually supports PCRE? Since the website supports PCRE and not POSIX.
std regex in c++ can also do ecma script js varient(if you supply the std::regex_constants::ECMAScript
in the regex constructor) and work in widnows. It work fine under msvc.
i'll follow up with what you guys need to add the generator
I think you need to do this
for (std::sregex_iterator i = words_begin; i != words_end; ++i) {
std::smatch match = *i;
std::string match_str = match.str();
if (match_str.size() > N) {
std::cout << " " << match_str << '\n';
}
}
according to this stack overflow answer you use std::regex_search
std::string new_s = std::regex_replace(s, long_word_regex, "[$&]");
std::regex_replace (std::back_inserter(result), s.begin(), s.end(), e, "$2");
codeproject.com/Questions/1221494/Simple-multiline-regex-in-Cplusplus
you must use ecmascript option to make regexes that are like js regex so you can recycle the current js engine for the c++ regexp
Code Generator Language
C++
Code Snippet
This generator take in account the regex replacement and the regex searching. It's take from cpp reference(https://en.cppreference.com/w/cpp/regex)