Last active
December 16, 2015 07:49
-
-
Save sundayu/5401936 to your computer and use it in GitHub Desktop.
JavaScript: validator
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
App.validator = | |
check: (str, regexp)-> | |
@[regexp].test str | |
url: /^(https?:)\/\/([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)+([a-zA-z]{2,6})(\/[a-zA-Z0-9$_.+!#*(),;\/?:@&~=%-]*)?$/ | |
email: /^([\w\.\-\+\=]+)@((?:[a-z0-9\-_]+\.)+[a-z]{2,6})$/i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment