php正则表达式


字符串匹配 int preg_match($pattern,$str,$matches/null);有多个匹配结果时则只返回第1个匹配结果
     int preg_match_all($pattern,$str,$matches/null);返回所有成功匹配的元素
数组匹配   array preg_greg($pattern,$str)

"/^[da-zA-Z][w]{1,10}@[w]{1,6}.[a-zA-Z]{2,4}$/"  //匹配邮箱

"/^[a-zA-Z0-9x{4e00}-x{9fa5}]$|^[a-zA-Z0-9x{4e00}-x{9fa5}][a-zA-Z0-9_s x{4e00}-x{9fa5}.]*[a-zA-Z0-9x{4e00}-x{9fa5}]$/u"
 //匹配中文,字母.数字
 
原文地址:https://www.cnblogs.com/sontan/p/7045164.html