squiggerz Posted November 29, 2007 Share Posted November 29, 2007 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 Quote Link to comment Share on other sites More sharing options...
squiggerz Posted November 29, 2007 Author Share Posted November 29, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.