• 年月日时分秒 正则表达式


    粗陋

     regExp.setPattern("^"
     "([0-9]{4}-"
     "((0([1-9]{1}))|(1[1|2]))-"
     "(([0-2]([1-9]{1}))|(3[0|1]))"
     "\s"
     "(([0-1]{1}[0-9]{1}|[2]{1}[0-4]{1}):([0-5]{1}[0-9]{1}):([0-5]{1}[0-9]{1}))"
     "$)");

    精确:
    regExp.setPattern("^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$");

      比较精确 

    ^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$"
  • 相关阅读:
    初识jQuery(2)
    初识jQuery(1)
    document和javaScript内置对象
    location
    history
    window对象
    注释、语法约定、函数和作用域
    运算符和typeof
    string
    数据恢复
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/4397151.html
Copyright © 2020-2023  润新知