I'm hoping someone could help me out with a little advice,<div>I'm trying to use a regex to extract data from a list of lats and longs, where lats and longs are defined using the regexs</div><div><div>  $vlat     = '<b>[-+]?\d{1,2}[.]\d+</b>'; # -90 .. 90</div>

<div>  $vlong    = '<b>[-+]?[1]?\d{1,2}[.]\d+</b>'; # -180 .. 180</div></div><div><br></div><div>The list of coordinate pairs looks like this</div><div><br></div><div><div>  $vlatlong = $vlat . '[,]' . $vlong; # latitude,longitude</div>

<div>  $pllbs    = 'llbs=' .<b> $vlatlong . '(?:[;]' . $vlatlong . ')+</b>'; # two or more pairs of lat long co-ordinates</div></div><div><br></div><div>I'd like to use subpatterns to extract the lats and longs,</div>

<div>along the lines of </div><div><div><br></div><div>    $lngs = preg_split ('/(?:' . $vlat . '[,](' . $vlong . ')[;])+/', $opt['llbs'] . ';');</div><div>or</div><div>    preg_match ('/(?:(' . $vlat . ')[,]' . $vlong . '[;])+/', $opt['llbs'] . ';', $lats);</div>

</div><div><br></div><div>where $opt['llbs'] = '-45.383518,168.267111;-45.374354,168.302387;-45.402745,168.254151';<br><br>But neither of these approaches works for me.</div><div>I suspect its something basic around the correct usage of the language or a function.</div>

<div>so if anyone could point me in the right direction I'd be grateful</div><div><br></div><div>Simon</div><div><br></div>