Jump to content

Help removing this string


chronister

Recommended Posts

Hello all... Happy Turkey Day for those who celebrate Thanksgiving, and Happy Thursday for everyone else :)

 

I am code scraping a page and I have managed to hack together a couple regex patterns that remove pieces I want gone in the code, but I am having trouble on this one. I have looked and just cannot wrap my brain around this regex stuff.

 

I have a string of text (html source code) and want to find and remove all occurrences of this string.

 

<sup class='footnote' value='[<a href="XXX" title="See footnote XXX">XXX</a>]'>[<a href="XXX" title="See footnote XXX">XXX</a>]</sup> 

 

In all the places you see XXX this is variable information.  I have tried some expressions, but they did not work. I am not sure if it is possible to simply find and replace everything between and including

 

<sup class='footnote' XXXXXXXX </sup>

 

Thanks in advance for help,

 

Nate

Link to comment
Share on other sites

I am absolutely not sure what you want, but this removes the whole thing.

 


<?php
error_reporting(E_ALL);

$a = "<sup class='footnote' value='[<a href=\"XXX\" title=\"See footnote XXX\">XXX</a>]'>[<a href=\"XXX\" title=\"See footnote XXX\">XXX</a>]</sup>";

echo preg_replace('@<sup (.*)>(.*)<\/sup>@', '', $a);

?>

 

If this is not what you want, please correct me and show me a example of how it must be!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.