Shortest URL regex match in JavaScript Create the shortest regular expression that will roughly match a URL in text when run in JavaScript

Example:

"some text exampley.com".match(/your regular expression goes here/);


The regular expression needs to 


capture all valid URLS that are for http and https. 
not worry about not matching for URL looking strings that aren't actually valid URLS like super.awesome/cool
be valid when run as a JavaScript regex


Test criteria:

Match:


http://example.com
http://example.com/
http://example.com/super
https://example.com/super
example.com/super
example.com
example.com/su-per_duper/?add=yes&amp;subtract=no
example.com/archive/index.html
twitter.com/#!/reply
example.com/234ret2398oent/234nth
codegolf.stackexchange.com/questions/464
crazy.wow.really.example.com/?cat=nth%3E
example-example.com
example1.com


Not Match:


example
super/cool
Good Morning
i:can
hello.


Here is a test that might help clarify a bit http://jsfiddle.net/MikeGrace/gsJyr/

I apologize for the lack of clarity, I hadn't realized how awful matching URLs was.
This one works:

var re = /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi;

/*
(^|\s)                            : ensure that we are not matching an url 
                                    embeded in an other string
(https?:\/\/)?                    : the http or https schemes (optional)
[\w-]+(\.[\w-]+)+\.?              : domain name with at least two components;
                                    allows a trailing dot
(:\d+)?                           : the port (optional)
(\/\S*)?                          : the path (optional)
*/


Passes the tests at http://jsfiddle.net/9BYdp/1/

Also matches:


example.com. (trailing dot)
example.com:8080 (port)