zoukankan      html  css  js  c++  java
  • 验证车牌警车能源车

    /**
    
    *   判断是否合法车牌号
    *  @name isCarLicense
    *  @param $license
    *  @return bool
    */
    function isCarLicense($license){
        if (empty($license)) {
            return false;
        }
        //普通车牌
        $regular = "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/u";
        preg_match($regular, $license, $match);
        if (isset($match[0])) {
            return true;
        }
        //小型新能源汽车
        $regular =  "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[0-9]{5}[DF]$/u";
        preg_match($regular, $license, $match);
        if (isset($match[0])) {
            return true;
        }
        //大型新能源汽车
        $regular =  "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[DF][A-HJ-NP-Z0-9][0-9]{4}$/u";
        preg_match($regular, $license, $match);
        if (isset($match[0])) {
            return true;
        }
        return false;
    }
    不断的修改不断的完善
  • 相关阅读:
    redis的基本操作
    python对txt的读写
    python random的练习
    python继承的练习
    python类和实例
    VS2019 自动代码补全功能
    GIT 删除操作
    vue-router 注意事项
    Vue中axios访问 后端跨域问题
    Vue2.0 搭配 axios
  • 原文地址:https://www.cnblogs.com/lhwhqy/p/9621102.html
Copyright © 2011-2022 走看看