deela Posted June 15, 2007 Share Posted June 15, 2007 Hi, I am trying to remove some tags from an XML document that I do not need. <string id="4466.8" encoding="repr">email</string> I want to remove the whole tag for the string but keep the content in the middle, the problem is that the id changes, so is there a way to use a 'wildcard' character in the replace code to replace any character found? $data=str_replace('<stringid="4466.8" encoding="repr">', ' ', $data); I saw a post that /S should work for any non whitespace character, this does not seem to work though... any idea's? Thanks. Link to comment https://forums.phpfreaks.com/topic/55729-replace-string-using-wildcards/ Share on other sites More sharing options...
per1os Posted June 15, 2007 Share Posted June 15, 2007 www.php.net/preg_replace www.php.net/ereg_replace www.php.net/eregi_replace Regular expressions http://en.wikipedia.org/wiki/Regular_Expressions www.php.net/regex is what you want. Link to comment https://forums.phpfreaks.com/topic/55729-replace-string-using-wildcards/#findComment-275357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.