I am not quite sure but this will do the trick:
$fixedfile="<img src=\"http://188.8.131.52/spacer.gif\" width=1 height=2>";
$fixedfile=preg_replace("/src=[^>]*?>/","src=\"<!---image goes here--->\">",
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
<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
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;
works like a charm....
Now I want to delete everything in the src section of an image tag, so I'm
$fixedfile=ereg_replace("src=\".*\">","src=\"<!---image goes here--->\"",
but this doesn't work.
What am I doing wrong?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php