Jump to content

Find & Replace Opening and Closing tags..


squiggerz

Recommended Posts

I sort of asked this in the regex section but this may require a more general answer, I'm not sure. Here's what I got:

 

 <a name="blah blah blah"> <b> Blah blah blah </b> </a> 

 

I added the spaces in between the tags for readability, they are either there or not in the code I'm trying to mutate.

 

What I'm trying to do is get rid of the opening and closing 'a' tags, is there an easy way to do this and make sure that only THAT set of 'a' tags get removed and leave the rest alone?

 

Thanks,

          Sq

 

 

 

Link to comment
Share on other sites

Ok, let's say I preg_replace the a name="blah blah blah"> tag with nothing. Now I'm left with a whole bunch of '/a>' tags, can I use some sort of preg replace or something that checks only for ending 'a' tags that are NOT preceeded by opening a tags before hitting a preceeding '/a' tag? Maybe something like:

((??<!(?:<a (.*?)>)).)*)

 

Yeah I know, I'm terrible with regex.. lol

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.