PHP preg_match: How is this variable(67278) to preg_match working? -
ex: 67278
how can using preg_match???
how can information preg_match?
$data = '<script>fcgetplayerinsights("67278")</script>)'; preg_match("/tr\('(.*?)'/",$data,$match); print_r($match);
i not recommend regex on html unless it's way...
but:
if(preg_match("/(\d{5})/", $data)){ echo "a 5 digit number there"; }else{ echo "there no 5 digit number"; }
may work..
recommend @ least use strip_tags
on $data.
if(preg_match("/(\d{5})/", strip_tags($data))){ echo "a 5 digit number there"; }else{ echo "there no 5 digit number"; }
that removes html string , leaves fcgetplayerinsights("67278"))
to regex on, bit safer.
Comments
Post a Comment