#include <regex>
const char* first = "";//需要验证的字符
std::regex rx("^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$");//验证的表达式,这个是18位身份证的
//std::regex rx("^1[3|4|5|8][0-9]\d{8}$");//这个是手机号
std::regex_constants::match_flag_type f1 =
std::regex_constants::match_default;
BOOL rv = std::regex_match(first,first+strlen(first),rx,f1);