title: Regular Expression to find entire link in string
body: <p>I have a regular expression in apex that is only grabbing part of the link I need in a string. I need it to grab the entire link.</p>
  
  <p>Here is what im working with:</p>
  
  <pre><code>String myvar = 'this is an example http://test.com/testing/123654123%0A%0A%0A%';
  
  String myvar1 = '(?:(?:(?:[a-z0-9]{3,9}:(?://)?)(?:[-;:&amp;=+$,w]+@)?[a-z0-9.-]+|(?:www.|[-;:&amp;=+$??,w]+@)[a-z0-9.-]+)((?:/[+~%/.w-]*)?\\??(?:[-+=&amp;;%@.w]*)#?w*)?)';
  
              Pattern MyPattern = Pattern.compile(myvar1);
  
              Matcher MyMatcher = MyPattern.matcher(myvar);
  
              while (MyMatcher.find()) { 
                  System.debug(MyMatcher.group());
                  Location = MyMatcher.group();
          }
  </code></pre>
  
  <p>This is only returning <a href="http://test.com/" rel="nofollow">http://test.com/</a></p>
  
  <p>I need <a href="http://test.com/testing/123654123" rel="nofollow">http://test.com/testing/123654123</a></p>
  
  <p>How can I modify the regular expression to provide the complete link?</p>
  
  <p>I just need to modify my existing regex to accomplish this. How can keep as much of the regular expression im using as possible?</p>
  
  <pre><code>(?:(?:(?:[a-z0-9]{3,9}:(?://)?)(?:[-;:&amp;=+$,w]+@)?[a-z0-9.-]+|(?:www.|[-;:&amp;=+$??,w]+@)[a-z0-9.-]+)((?:/[+~%/.w-]*)?\\??(?:[-+=&amp;;%@.w]*)#?w*)?)
  </code></pre>