Here is my code:
preg_match_all('/<a href="(.+?)index.php(.+?)&abc=(.+?)"/', $dataToParse, $matches);
foreach ($matches as $val)
{
$absUrl = $val[1] . 'index.php' . $val[2] . '&abc=' . $val[3];
echo $absUrl;
}
However, $val[1]
is the entire matched string, including the <a href
. I believe I have the syntax wrong but I have been trying to fix it with no luck. Not sure how to do this properly.