Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用时如何获取匹配的索引std::tr1::regex_search?
std::tr1::regex_search
// sequence of string sub-matches std::tr1::smatch result; if (!std::tr1::regex_search(text, result, pattern)) return false;
我只能从std::tr1::smatch result变量中获取字符串,但不能获取匹配的索引。
std::tr1::smatch result
我错过了它,因为我搜索了一种index方法,但它作为一种方法就在那里 -std::tr1::smatch::position()将给出匹配的索引。
index
std::tr1::smatch::position()