Re: regex (preg_replace)
| From: | Gerard Samuel | Date: | Sun, 19 May 2002 05:34:02 +0000 |
| Subject: | Re: regex (preg_replace) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98335@lists.php.net to get a copy of this message | ||
I figured it out. Change the last line to
echo htmlspecialchars($b);
and you'll get the proper output.
Gerard Samuel wrote:
Im trying to get a final output to be '<item>' but Im unable to get working. Could someone point me where Im going wrong. Thanks <?php $a = '<item rdf:about="http://www.trini0.org">'; $b = preg_replace("/(<item)(\s.*)(>)/i", "$1" . "$3", $a ); echo $b; ?>