PHP常用正则表达式

//用户名必须为字母、数字与下划线
if (!preg_match('/^\w+$/i', $username))

//验证邮箱格式是否正确
if (!preg_match('/^[\w\.]+@\w+\.\w+$/i', $useremail))

//手机号必须为11位数字,且为1开头
if (!preg_match('/^1\d{10}$/i', $usermobile))

原文地址:https://www.cnblogs.com/besti/p/4330999.html