I am writing the loading procedure for my application and it involves reading data from a file and creating an appropriate object with appropriate properties.
The file c
Your problem is quite simpler than it looks. This:
const std::regex regexTest( "=== ([^=]+) ===\\n((?:.|\\n)*)\\n=== END \\1 ===" );
worked perfectly on clang++/libc++. It seems that \n
does not fit into []
brackets in ECMAscript regexen. Remember to use while regex_search
instead of if regex_match
if you want to look for more than one instance of the regex inside the string!
Try to use:
lazy quantifiers:
=== (.+?) ===\\n([\\s\\S]*?)\\n=== END \\1 ===
negative classes and negative lookaheads:
=== ((?:[^ ]+| (?!===))+) ===\\n((?:[^\\n]+|\\n(?!=== END \\1 ===))*)
POSIX:
=== (.+?) ===\n((.|\n)*?)\n=== END [^=]+? ===