I'm getting inconsistencies when comparing results from C++ MSVC and RegExr.
I'm trying to find references within a json schema:
"$ref":"X.json#/definitions/X"
To account for whitespace before and after the colon, on RegExr I'm using this regular expression:
"\$ref"\s*:\s*".*?"
In C++ I've escaped the string to:
//Search the file for any "$ref": variables using regex
std::regex regexExpression("\"\\$ref\"\\s*:\\s*\".*?\"");
std::smatch matches;
if(std::regex_search(fileContents, matches, regexExpression))
{
for (auto str : matches)
{
On Regexr this will be caught:
"$ref" : "X.json#/definitions/X"
Whereas in the C++ program that will not.
Any ideas?