title: get url from string
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1146198/get-a-url-from-a-string">Get a URL from a String</a>  </p>
  </blockquote>
  
  
  
  <p>Hi, im trying to extract a url from a string using regexp. the string is something like:
  "lorem ipsum baby www.test.com lorem", "lorem ipsum <a href="http://www.test.com" rel="nofollow noreferrer">http://www.test.com</a> foo bar" or "lorem www.test.com" with no trailing whitespace.<br>
  using<br>
  <code>MatchCollection ms = Regex.Matches(adress, @"(www.+|http.+)([\s]|$)");</code><br>
  returns the entire string. Could any regexp-guru help me out on this one? </p>
  
  <p>Edit:<br>
  Solved it this way:<br>
  <code>MatchCollection mc = Regex.Matches(adress, @"(www[^ \s]+|http[^ \s]+)([\s]|$)", RegexOptions.IgnoreCase);<br>
  adress = mc[0].Value;<br>
  WebBrowserTask task = new WebBrowserTask();<br>
  task.URL = adress;<br>
  task.Show();</code>  </p>
  
  <p>Thank you all for your help! :)</p>