note 26210 added to function.preg-replace
| From: | my at mail dot com | Date: | Tue, 22 Oct 2002 16:00:48 +0000 |
| Subject: | note 26210 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38424@lists.php.net to get a copy of this message | ||
It drives me crazy, no good documentation to be found on the Regular Expressions. In the end I
bought a pocket book of Perl (O'reilly) which seems to answer most questions.
Anyway, the next code is too simple to be true, but it put quotation marks in a FONT tag. Needed to
do this for importing it to Flash after editing it in an online DOM WYSIWYG editor. (Flash
doesn't like ugly HTML tags).
$txt = "<FONT COLOR=#454545>";
And this is what it returns:
<FONT COLOR="#454545">
CODE:
$txt = preg_replace("/(<FONT
COLOR=)(#[0-9A-Za-z]{6})(>)/","\\1\"\\2\"\\3",$txt);
Hope it did help some people.
Greets, Joeri
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+26210
http://master.php.net/manage/user-notes.php?action=delete+26210
http://master.php.net/manage/user-notes.php?action=reject+26210