0
需要匹配字符串中包含字符串“file:// \\”和“report”的字符串。需要匹配包含字符串文件的字符串:和报告字符串
如果我使用正则表达式(file:// \\\\)(。*)\\\\ report \\\\(。*)它工作正常。但是,如果我使用表达式(file:// \\\\)(。*)\\ report \\(。*)它会给出错误。
我的问题是为什么需要使用四个反斜杠(\\\\)来匹配报告字符串之前和之后的一个反斜杠。
*wstring target(L"file://\\\\Example\\report\\001");
wsmatch wideMatch;
wregex wrx(L"(file://\\\\)(.*)\\\\report\\\\(.*)");
if (regex_match(target.cbegin(), target.cend(), wideMatch, wrx))
wcout << L"The matching text is:" << wideMatch.str() << endl;*
可以有人请回答。在此先感谢...
是不是经过特殊处理?所以\ t意味着制表符\ n新行和\ \意味着单个\? – DawidPi