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

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 *