XML Cleanup Regex
| From: | Gerard Samuel | Date: | Sat, 11 Jan 2003 16:10:36 +0000 |
| Subject: | XML Cleanup Regex | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-131264@lists.php.net to get a copy of this message | ||
Im trying to clean up xml data of illegal characters.
I need a pointer as to how to get a regex to perform this.
Here is my feable attempt ->
<?php
header('Content-type: text/plain');
$foo = '<title>It\'s a test</title>';
//$bar = preg_replace('/[^\w\s<>\/]+/', ''', $foo);
$bar = preg_replace('/(<title>)([\'])(<\/title>)/', '$1' . ''' . '$3', $foo);
echo $bar;
?>
Im trying the 2nd way, because I want to only do this clean up between certain tags..
Thanks for any help you may provide.
--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/