note 19271 added to function.preg-replace

From: Date: Thu, 21 Feb 2002 16:25:14 +0000
Subject: note 19271 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-26893@lists.php.net to get a copy of this message
I have been working all day on this RegEx which I may only use once so I thought it would be nice at least to share it. What this thing do is it strips all <font...>...</font> tags from a document with the exception of those that contain face="symbol". You usually want to keep those as they signal a special character, frequently used in scientific papers for example. The thing goes like this: preg_replace("/(?(?!(<font[^>]+?Symbol[^>]+?>.+?<\/font>)) <font[^>]+?>(.+?)<\/font>)/is", "\\2", $fileCnt); I hope you will find it useful. -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+19271 http://master.php.net/manage/user-notes.php?action=delete+19271 http://master.php.net/manage/user-notes.php?action=reject+19271

« previous php.notes (#26893) next »