I've written a regular expression that is used to parse out the various elements of a log string in the following format:
0|Verbose|General| Logging system initialised
0|Verbose| Thread| Starting threads...
0|Verbose| Thread| Waiting for threads to finish...
Expression:
regex rg(R"(\s*(\d+)\|\s*([a-zA-Z]+)\|\s*([a-zA-Z]+)\|\s*([a-zA-Z\s]+))");
In online testers (e.g. https://regexr.com/), it works as expected.
When I use it in my C++ program, however, it will split the first log string up as follows:
0
|Verbose|General|
Logging
system
I've tried using various std::regex_constant arguments (e.g. extended, basic, ECMAScript) but to no success.
Any ideas why this is happening/what I'm doing wrong? I'm new to Regex