php - Regex need to remove unwanted characters -
following recent question regarding regex html has been answered here (thank all), made decision stick regex last time. goal grab value updatexxxx following html code using curl:
(...)<input type="hidden" id="_postupdate" name="_postupdate" value="updatexxxx" /><input type="hidden"(...) using
$regex = '/name="_postupdate" value="([^"]*)" \/><input type="hidden"/s'; if ( preg_match($regex, $page, $list) ) echo $list[0]; i managed output:
name="_postupdate" value="updatexxxx" /> i'm sure there simple way remove:
name="_postupdate" value=" and
" /> once again, advice , :)
change echo $list[0]; echo $list[1];
you're outputting whole match, when want captured group ([^"]*).
Comments
Post a Comment