Created
September 28, 2013 07:11
-
-
Save xyqfer/6739410 to your computer and use it in GitHub Desktop.
表单验证正则
This file contains 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
var ruleRegex = /^(.+?)\[(.+)\]$/, | |
numericRegex = /^[0-9]+$/, | |
integerRegex = /^\-?[0-9]+$/, | |
decimalRegex = /^\-?[0-9]*\.?[0-9]+$/, | |
emailRegex = /^[a-zA-Z0-9.!#$%&'*+\-\/=?\^_`{|}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$/, | |
alphaRegex = /^[a-z]+$/i, | |
alphaNumericRegex = /^[a-z0-9]+$/i, | |
alphaDashRegex = /^[a-z0-9_\-]+$/i, | |
naturalRegex = /^[0-9]+$/i, | |
naturalNoZeroRegex = /^[1-9][0-9]*$/i, | |
ipRegex = /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i, | |
base64Regex = /[^a-zA-Z0-9\/\+=]/i, | |
numericDashRegex = /^[\d\-\s]+$/, | |
urlRegex = /^((http|https):\/\/(\w+:{0,1}\w*@)?(\S+)|)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment