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.

http://www.phpliveregex.com/p/hno


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -