note 26231 added to function.preg-replace
| From: | my at mail dot com | Date: | Wed, 23 Oct 2002 13:43:04 +0000 |
| Subject: | note 26231 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38452@lists.php.net to get a copy of this message | ||
Me again,
Meanwhile one long night further I found some documentation on the internet.
http://www.tjhsst.edu/~dhyatt/perl/exA.html
Further more I rewrote the above script to a more flexible script.
$text = preg_replace("/<(.*?)(=)(?!\")(.*?)(>|[[:space:]])/is",
"\\1\\2\"\\3\"\\4",$text);
It now will replace ALL instances of HTML tags without quatation marks AND it is not dependable on
lower or uppercase anymore (the /is did the trick). Repeat the code for more instances within the
TAG.
eg. <FONT COLOR=#444444 SIZE=3 BGCOLOR=#456743>
You'll have to repeat the string for 3 times to fix the TAG!
Result:
<FONT COLOR="#444444" SIZE="3" BGCOLOR="#456743">
Ciao!
Joeri
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+26231
http://master.php.net/manage/user-notes.php?action=delete+26231
http://master.php.net/manage/user-notes.php?action=reject+26231