note 26210 deleted from function.preg-replace by sander

From: Date: Sat, 15 Feb 2003 15:22:38 +0000
Subject: note 26210 deleted from function.preg-replace by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43985@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

« previous php.notes (#43985) next »