--匹配规格--
$g = "25kg*1/箱";
#匹配 25g/箱; 25kg*1/箱; 5L/桶
preg_match("/^(\d+)?(kg|g|l|ml)(\*?)(\d*)?/i",$g,$mc); //$mc 数组
--匹配整数--
$number = '12';
preg_match("/^[1-9][0-9]*$/" ,$number);
--判断是都是时间格式--
$preg = "/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/";
preg_match($preg, '2020-07-04');
#登录判断
if (!preg_match('/^(?![A-Za-z0-9]+$)(?![a-z0-9\W]+$)(?![A-Za-z\W]+$)(?![A-Z0-9\W]+$)[a-zA-Z0-9\W]{8,}$/',$_POST['password1'])){
die(json_encode(array('status'=>0,'msg'=>'密码设置规则必须满足:一位特殊符号+大小写混合字母+数字','p' => $_POST['password1'])));
}
# 纯数字
$digital = preg_match("/^\d*$/", $data['password']);
# 纯字母
$letter = preg_match("/^[a-zA-Z\s]+$/", $data['password']);