case selection based on pregmatch
<p>I have a form that when a url is placed in the form and the button is clicked the URL is process and based on the pregmatch it extracts a URL. When a match is found for one of them the others return an error <code>Notice: Undefined offset: 1</code> how can i make it so that if a match is found for one the others are not giving an error?</p>

<pre><code>if ( !isset( $_GET['go'] ) ) return;
$userLink =  $_GET['go'] ;
if ( !$userLink ) return;

$data = file_get_contents($userLink);
preg_match("@^(?:\s)*var url = '(.*)';@mi",$data, $parsed1);
preg_match("@^(?:\s)*self.location = '(.*)';@mi",$data, $parsed2);
preg_match("@^(?:\s)*window.location = \"(.*)\";@mi",$data, $parsed3);
preg_match("@^(?:\s)*Lbjs.TargetUrl = '(.*)';@mi",$data, $parsed4);
preg_match("@^(?:\s)*linkDestUrl = '(.*)';@mi",$data, $parsed5);

echo 'var.url - ' . $parsed1[1] . '&lt;br&gt;';
echo 'self.location - ' . $parsed2[1] . '&lt;br&gt;';
echo 'window.location - ' . $parsed3[1] . '&lt;br&gt;';
echo 'Lbjs.TargetUrl - ' . $parsed4[1] . '&lt;br&gt;';
echo 'linkDestUrl - ' . $parsed5[1];
</code></pre>
