View Full Version : cant find word in string

01-27-2012, 11:51 PM
I am using preg_match to search html for a particular string

I have checked and the html is loaded into the variable I need. Currently I am using this syntax to retrieve the word but all I get is 'Array()' with a print_r

$viewResponse = htmlspecialchars($response);

$pattern = '/^confirm/';

preg_match($pattern, $viewResponse, $matches);

ideally I need to get the long alphanumeric string which follows after '&confirm='

But for now I am trying to get some response from preg_match

Any ideas?

01-28-2012, 04:52 AM
perhaps a diff approach would work

$viewResponse = htmlspecialchars($response);
$respParts = explode("&",$viewResponse);
$j = count($respParts);
for($i = 0; $i < $j; $i++){
echo substr($respParts[$i],8);