有一个简单的C++方法在字符串上使用模式匹配?代码听起来像这样:
if (regexpcmp("l?nole*[0-9]", "linoleum1")) {
//we have a match!
} else {
//no match
}
Run Code Online (Sandbox Code Playgroud)
Reu*_*nen 11
你有没看过Boost.Regex?
const boost::regex e("l?nole*[0-9]");
if (regex_match("linoleum1", e)) {
//we have a match!
} else {
//no match
}
Run Code Online (Sandbox Code Playgroud)