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