chronister Posted May 2, 2007 Share Posted May 2, 2007 Not sure if this should go explicitly in the regex section, but here goes. I am trying to wrap my brain around these things and I just cannot seem to do it. I am looking to essentially remove everything contained in between <i></i> tags as well as the tags themselves. An example of these code snippets are below. example 1 <i> Written by <a href="/SearchPlotWriters?%7BN2XFYLS@aol.com%7D">{N2XFYLS@aol.com}</a> </i> example 2 <i> Written by <a href="/SearchPlotWriters?Scott%20Huntsman%20%7Bguru@movieguru.com%7D">Scott Huntsman {guru@movieguru.com}</a> </i> I found an awesome IMDB class, and I am modifying it to insert data into a database. I want to get rid of the Written by section of the plots Any help would be appreciated. Regex syntax is mind-boggling to me right now. Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted May 2, 2007 Share Posted May 2, 2007 preg_match('/(.+?)<i>.+?<\/i>(.+)/s', $subject, $regs) You need to grab group one (everything before the < i >) and group two (everything after the </ i >) and + them together. Then 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.