Jump to content

preg_match prob.


sx

Recommended Posts

Ok I am wanting to check the content between the image tags in a post.  I want to make sure the the links point to one of three hosts only.  those hosts are tinypic, photobucket, imageshack.  Here is what I got so far.

 

$test = "[img=http://www.photobucket.com/files/rar.jpg]";

if (preg_match("/img([^\\[]*)\\/photobucket/",$test) || preg_match("/img([^\\[]*)\\/tinypic/",$test) || preg_match("/img([^\\[]*)\\/imageshack/",$test)){
echo "Hi";}
else {echo "no";}

 

But no matter what I put in there I get the "no".  What am I doing wrong here?

Link to comment
https://forums.phpfreaks.com/topic/45976-preg_match-prob/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.