Regex Pattern for Matching URLs

John Gruber has posted an update to his Regex Pattern for Matching URLs post. The pattern itself now lives at https://gist.github.com/gruber/8891611.

Related to this is a review of URL validation regular expressions. It compares 13 different methods, but only for URL validation, not necessarily matching.

I’m not super keen on the idea of having a list of TLDs as part of the regex, since the number of TLDs is continuing to grow. I do like that Gruber’s regex includes comments in it, that is really helpful for longer, more complex expressions.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>