I am not quite sure but this will do the trick: <?php $fixedfile="<img src=\"http://64.4.14.24/spacer.gif\" width=1 height=2>"; $fixedfile=preg_replace("/src=[^>]*?>/","src=\"<!---image goes here--->\">", $fixedfile);
#preg_replace("/[search]/","[replacement]",[string]); exit ($fixedfile); ?> I have made some differences from what you were trying to do: I used preg_replace, I added ">" to the replacement since without it you would get: <img src="<!---image goes here--->" which would be incorrect HTML (<img src=""> would be correct). A note From a PHP manual.: preg_replace(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg_replace(). "Kelly Meeks" <[EMAIL PROTECTED]> wrote in message 002701c22832$3992e800$6501a8c0@yourw92p4bhlzg">news:002701c22832$3992e800$6501a8c0@yourw92p4bhlzg... Hi folks, I'm trying my hand at some pattern matching, and I have a question. I need to take all the text between the title tags of a page, and replace it. This I can do, with the following: $fixedfile=ereg_replace("<title>.*</title>","<title><? echo \$bstitle; ?></title>", $fixedfile); works like a charm.... Now I want to delete everything in the src section of an image tag, so I'm trying this: $fixedfile=ereg_replace("src=\".*\">","src=\"<!---image goes here--->\"", $fixedfile); but this doesn't work. What am I doing wrong? Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php