I need a regEx to match general URLs

I need to test for general URLs using any protocol (http, https, shttp, ftp, svn, mysql and things I don't know about).

My first pass is this:

\w+://(\w+\.)+[\w+](/[\w]+)(\?[-A-Z0-9+&@#/%=~_|!:,.;]*)?

(PCRE and .NET so nothing to fancy)

Answers


According to RFC2396:

^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

Need Your Help

Can we distinguish between a Martian sunset and a telluric sunset?

image-processing analysis

Here is an image taken by Spirit. I get it from APOD. The sun is smaller and the atmosphere is kind of reddish. But under some weather circumstances on our earth, we may get a similar image, which ...

NullPointerException in getView Of Adapter extends BaseAdapter

android android-widget baseadapter layout-inflater

I am populating listview for search in tabwidget.My list contain an image and textview.Without TabWidget it works fines but in TabWidget it gives error .I have error in getview My locat is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.