mercredi 25 mars 2015

boost hostnames regex capture group 1

Here are my regex and tests (in the unit test section).



boost::regex expression(R"((?:\w*:\/\/)(?:w{0,3}\.)?(\w+\.\w+\.?\w*)(?::\d+)?\/?)");
boost::match_results<string::const_iterator> matches;
boost::regex_search(host, matches, expression);
const string result = matches[0];


I am trying to get capture group one, but, examining the results in the debugger, I can't seem to find the results of capture group one, and if they are there, then the regex isn't working and is capturing the whole string.


Aucun commentaire:

Enregistrer un commentaire