Created
July 5, 2014 09:32
-
-
Save hehongwei44/4db037bfc161a3e0f776 to your computer and use it in GitHub Desktop.
判断输入的参数是否是国内合法的邮编地址
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断输入的参数是否是国内合法的邮编地址(ps:国内不包含国外的邮编) | |
* @link: http://www.youbianku.com/%E9%A6%96%E9%A1%B5 | |
* @param: str为待验证的邮编号码 | |
* @return: true表示为合法的邮编号码 | |
* | |
*/ | |
var isPostcode = function(str) { | |
//国内邮编以0-8开头的6为数字 | |
var pattern = /^[0-8]\d{5}$/; | |
return pattern.test(str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment