PHP: problem with patterns

From: Date: Fri, 09 Aug 2002 11:50:32 +0000
Subject: PHP: problem with patterns
Groups: php.general 
Request: Send a blank email to php-general+get-111803@lists.php.net to get a copy of this message
Hi again, I hope u can help me with this. I have to parse an html file and replace src attribute of an img. I'm using 'preg_match_all' but it seems i'm having problem with patterns. This is the part of code that should find the appropriate img src: $preg='/<img(.*?)src=[\'|"]'.addcslashes($original,"/").'[\'|"](.*?)>/si'; if (preg_match_all($preg,$arrFile,$match)) { echo $match[1][0]; } where $original contains the value of src that it should find. For expl, $original can be: ../../MyMCMSSite/images/pic1_abeoway.gif. But the problem is it's not catching the right img src. Hope u can help me. Thx a lot Alia

« previous php.general (#111803) next »