Created
December 24, 2013 10:35
-
-
Save zhasm/8111447 to your computer and use it in GitHub Desktop.
url regex.
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
const URL_REGEXP_PROTOCOL = '(?:(http|https):\/\/)'; | |
const URL_REGEXP_USER = '(?:[^\/]+?(?::[^\/]+?)?@)?'; | |
const URL_REGEXP_HOST = '(?:(?:(www\.)?(?:[\w\-]+\.)+(?:[a-z]{2,4}))|(?:(?:\d{1,3}\.){3}\d{1,3}))'; | |
const URL_REGEXP_PORT = '(?::\d{1,5})'; | |
const URL_REGEXP_QUERY = '(?:\/[\w\-\?\.\=\&\+\%\[\]\/#;@:~!]*)'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment