RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find A Liberal, Accurate Pattern for Matching URLs
Expression
\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))
Description
Identifies the URLs in an arbitrary string of text, where by “arbitrary” let’s agree we mean something unstructured such as an email message or a tweet. Source: daringfireball.net
Matches
http://foo.com/blah_blah | http://foo.com/blah_blah/ | (Something like http://foo.com/blah_blah) | http://foo.com/blah_blah_(wikipedia) | (Something like http://foo.com/blah_blah_(wikipedia)) | http://foo.com/blah_blah. | http://foo.com/blah_blah/. | <http://foo.com/blah_blah> | <http://foo.com/blah_blah/> | http://foo.com/blah_blah, | http://www.example.com/wpstyle/?p=364. | http://✪df.ws/123 | rdar://1234 | rdar:/1234 | http://userid:[email protected]:8080 | http://[email protected] | http://[email protected]:8080 | http://userid:[email protected]
Non-Matches
no_ws.example.com | no_proto_or_ws.com | /relative_resource.php
Author Rating: Not yet rated. Scott C
Source http://daringfireball.net/2009/11/liberal_regex_for_matching_urls
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials