Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ultimate Url Regex!
Based off of Gruber's awesome url regex:
In addition:
- Should match '', '', ''. (only com, net, and org are whitelisted).
- Should not match ''.
var URL_RE = /(?:(?=[\s`!()\[\]{};:'".,<>?«»“”‘’])|\b)((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/|[a-z0-9.\-]+[.](?:com|org|net))(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))*(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]|\b))/gi

This comment has been minimized.

Copy link

commented May 23, 2013

Thank you very much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.