Couldn't think of any other way to phrase it - sorry....
Anyway, I'm extracting data from WordPress Databases and creating an xml file. I use str_replace() to strip out the embedded characters such as the '<!--> more>' or the '<strong>' etc and everything is working well.
Except when the post contains an embedded image, at that point the only common characters seem to be '<img class=> and a '/>' to mark the end, I've searched for wild card usage when replacing a string, but I can't seem to find anything out there.
If someone has any ideas or could point me in the right direction, I'd appreciate it.
Thanks
Stripping out "<" and ">" while creating an xml file
Moderator: General Moderators
-
PastorHank
- Forum Contributor
- Posts: 117
- Joined: Sat Jun 03, 2006 7:58 am
- Location: Texas Hill Country
Re: Stripping out "<" and ">" while creating an xml file
Could you just use htmlentities for this purpose? All < > and ' " will be reverted to their html entity counterpart.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
PastorHank
- Forum Contributor
- Posts: 117
- Joined: Sat Jun 03, 2006 7:58 am
- Location: Texas Hill Country
Re: Stripping out "<" and ">" while creating an xml file
I'll look into it, late, late, late last night I tried
And it seems to work, but the file I have to check is huge, so I'm not sure it got all the little buggers....
Code: Select all
$s2 = preg_replace('<img .* />', '', $s1);