Created
March 7, 2016 09:42
-
-
Save ismnoiet/f0adf8267635091cd688 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
window.validator = { | |
tel:/^0[0-9]{8,9}$/, | |
fax:/^0[0-9]{8}$/, | |
mob:/^0[0-9]{9}$/, | |
username:/^[a-z0-9_-]{3,16}$/, | |
name:/^[a-z ]+$/, | |
email:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/, | |
url:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.\-&\?=]*)*\/?$/, | |
anything:/.+?$/, | |
test:function(type,str){ | |
return this[type].test(str); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment