c++ 正则表达式验证手机号码

来源:互联网 发布:感染hiv知乎 编辑:程序博客网 时间:2024/05/21 10:58


#include <regex>

这里方法带入一个参数 mobilenumer

 bool temp = false;
 regex e("^1(3\\d|47|5([0-3]|[5-9])|8(0|2|[5-9]))\\d{8}$");
 
 if (regex_match(mobilenumer, e))
 {
  //CCLog("okokokokokokokokok");
  temp = true;
 }
 else{
  //CCLog("shitshitshitshit");
  temp = false;
 }


0 0
原创粉丝点击