Categories
Posts

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.