title: php preg_match get everything after match in string
body: <p>Looking for how to get the complete string in a URI, after the away?to=</p>
  
  <p>My code:</p>
  
  <pre><code>if (isset($_SERVER[REQUEST_URI])) {
      $goto = $_SERVER[REQUEST_URI];
  }
  
  if (preg_match("/to=(.+)/", $goto, $goto_url)) {
  
  $link = "&lt;a href='{$goto_url[1]}' target='_blank'&gt;{$goto_url[1]}&lt;/a&gt;";
  </code></pre>
  
  <p>The original link is:</p>
  
  <pre><code>https://domain.com/away?to=http://www.zdf.de/ZDFmediathek#/beitrag/video/2162504/Verschw%C3%B6rung-gegen-die-Freiheit-%281%29
  </code></pre>
  
  <p>.. but my code is cutting the string after the <strong>away?to=</strong> to only </p>
  
  <pre><code>http://www.zdf.de/ZDFmediathek
  </code></pre>
  
  <p>You know the fix for this preg_match function to allow really every character following the <strong>away?to=</strong> ??</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Found out, that <code>$_SERVER['REQUEST_URI']</code> or <code>$_SERVER['QUERY_STRING']</code> is already cutting the original URL. Do you know why and how to prevent that?</p>