1.匹配IP地址
const std::regex pattern("^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$");
return std::regex_match(sIP, pattern);
const std::regex pattern("^((https|http|ftp|rtsp|mms)?://)+.*$");
return std::regex_match(strUrl, pattern);
const std::regex pattern("(\\b1[35][0-9]\\d{8}|147\\d{8}|1[8][01236789]\\d{8}\\b)");
return std::regex_match(phone, pattern);
参考网站: http://www.cnblogs.com/leejersey/p/3415422.html 点击打开链接