Jump to content

Replace String using Wildcards


deela

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.