Created
June 21, 2017 01:54
-
-
Save HereChen/5253caa908ff1b6f6da3792111f5c90e 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
// validate url | |
// 检查 url 是否合法 | |
// https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url | |
// http://regexr.com/3e6m0 | |
function isUrl(url) { | |
return /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i.test(url); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment