多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ public function index() { $email = "2282017xxx@qq.com"; $pattern = "/^\w+@[\w|\d]+\.\w{2,3}$/"; print_r(preg_match($pattern,$email)); $url = "https://gitee.com/xxxx/xxxxxx/xx"; $pattern = "/^(https|http):\/{2}\w+\.\w+(\/\w).*$/"; print_r(preg_match($pattern,$url)); $tel = "15739xxx105"; $pattern = "/^1[34578]\d{9}$/"; $pattern = "/^1(3|4|5|7|8)\d{9}$/"; print_r(preg_match($pattern,$tel)); } ===================================js=============================== let search = ()=>{ let tel = "18739xxx105"; let preg1 = /^1[0-9]\d{9}$/ console.log(preg1.test(tel)) let email = "228xxx7407@qq.com"; let preg2 = /^\w+@(\w|\d)+\.\w{2,3}$/ console.log(preg2.test(email)) let url = "https://gitee.com/xxx/dashboard/projects"; let preg3 = /^(https|http):\/{2}\w+\.\w+(\/\w).*$/ console.log(preg3.test(url)) } search() <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <input onkeyup="search(this.value)"; type="text"> </body> <script> let search = (text="<h1>正则表达式 - <span class='color_h1'>元字符</span></h1>")=>{ let preg_tel = /[\u0600-\u06ff]+/g let preg_tel = /[0-9]+/g let preg_tel = /<[^>]+>/gi console.log(preg_tel.test(text)) console.log(text.match(preg_tel)) console.log(text.replace(preg_tel,"")) let preg_ug = /^[\u0600-\u06ff]+$/; //维吾尔文 let preg_cn = /^[\u4e00-\u9fa5]+$/; //中文 let preg_en = /^[A-Za-z]+$/; //英文 let preg_number = /^[0-9]+$/; //数字 console.log(preg_cn.test(text)) if (preg_ug.test(text)){ alert("ئۇيغۇرچە بار") }else if(preg_cn.test(text)){ alert("中文") }else if(preg_en.test(text)){ alert("englis") }else if(preg_number.test(text)){ alert("0-9") }else{ alert("不是纯纯的一种东西") } } search() </script> </html> ~~~