1

だからここに私のプログラムがあります:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <regex>
#include <windows.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    string str = "<link rel=\"shortcut icon\" href=\"http://joyvy.com/img/favicon.png\" />";
    regex expr("<link rel=+(\"|')+shortcut+(.*?(\"|'))+(.*?)href=(\"|')+(.*?)+(\"|')");
    smatch matches;

    cout << "start..." << endl;
    regex_match(str, matches, expr);
    cout << "this will not be printed";
}

そして、ここに私のプログラムの出力があります:

start...

std::regex_match() 関数呼び出しは、プログラムをフリーズするだけです。2 ~ 3 分経過すると、次のエラーが表示されます。

Unhandled exception at at 0x7515B760 in regex.exe: Microsoft C++ exception: std::regex_error at memory location 0x001D9088.

では、何が問題なのですか?

4

1 に答える 1