regex_match 例子1: #include "stdafx.h" #include <boost/regex.hpp> #include <string> #include <stdio.h> int _tmain(int argc, _TCHAR* argv[]) { boost::regex expression("Hello//s*.*"); std::string strTest = "Hello Boost"; if (boost::regex_match(strTest, expression)) { printf("Match!/n"); } else { printf("Not Match!/n"); } return 0; } regex_search: #include "stdafx.h" #include <boost/regex.hpp> #include <string> #include <stdio.h> int _tmain(int argc, _TCHAR* argv[]) { boost::regex expression("ello"); std::string strTest = "Hello Boost"; if (boost::regex_search(strTest, expression)) { printf("Find!/n"); } else { printf("Not Find!/n"); } return 0; }