# 0. 127.0.0.1 (ip:port)
'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$'
# 1. 1 to 12 (hour or month)
^(1[0-2]|[1-9])$
# 2. 1 to 24 (hour)
^(2[0-4]|1[0-9]|[1-9])$
# 3. 1 to 31 (day of the month)
^(3[01]|[12][0-9]|[1-9])$
# 4. 1 to 53 (week of the year)
^(5[0-3]|[1-4][0-9]|[1-9])$
# 5. 0 to 59 (minute or second)
^[1-5]?[0-9]$
# 6. 0 to 100 (percentage)
^(100|[1-9]?[0-9])$
# 7. 1 to 100
^(100|[1-9][0-9]?)$
# 8. 32 to 126 (printable ASCII codes)
^(12[0-6]|1[01][0-9]|[4-9][0-9]|3[2-9])$
# 9. 0 to 127 (nonnegative signed byte)
^(12[0-7]|1[01][0-9]|[1-9]?[0-9])$
# 10. -128 to 127 (sinned byte)
^(12[0-7]|1[01][0-9]|[1-9]?[0-9]|-(12[08]|1[01][0-9]|[1-9]?[0-9]))$
# 11. 0 to 255 (unsigned byte)
^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$
# 12. 1 to 366 (day of the year)
^(36[0-6]|3[0-5][0-9]|[12][0-9]{2}|[1-9][0-9]?)$
# 13. 1900 to 2099 (year)
^(19|20)[0-9]{2}$
# 14. 0 to 32967 (nonnegative signed word)
^(3276[0-7]|327[0-5][0-9]|32[0-6][0-9]{2}|3[01][0-9]{3}|[12][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$
# 15. -32768 to 32767 (signed word)
^(3276[0-7]|327[0-5][0-9]|32[0-6][0-9]{2}|3[01][0-9]{3}|[12][0-9]{4}|[1-9][0-9]{1,3}|[0-9]|-(3276[0-8]|327[0-5][0-9]|32[0-6][0-9]{2}|3[01][0-9]{3}|[12][0-9]{4}|[1-9][0-9]{1,3}|[0-9]))$
# 16. 0 to 65535 (unsigned word)
^(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$
部分转载于:https://blog.csdn.net/guaguastd/article/details/39049843
对错误进行了修改!