Replacing text on page, but not in <img> tags
| From: | Taylor York | Date: | Thu, 06 Nov 2003 20:35:38 +0000 |
| Subject: | Replacing text on page, but not in <img> tags | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-168770@lists.php.net to get a copy of this message | ||
Lets say im trying to replace every occurance of 'hello' with
'<b>hi</b>'.
heres a sample page
<html>
hello there!
</html>
This would simply change to
<html>
<b>hi</b> there!
</html>
but what if it had an img?
<html>
hello there!
<img src="hello.jpg" alt="well hello there">
</html>
It would then be,
<html
<b>hi</b> there!
<img src="<b>hi</b>.jpg" alt="well <b>hi</b>
there">
</html>
It would then be completely jacked up. Not only would it do the wrong img,
but the tag in general would be screwed be cause of the bold tag. So what
can I do?