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?%[email protected]%7D">{[email protected]}</a> </i> example 2 <i> Written by <a href="/SearchPlotWriters?Scott%20Huntsman%20%[email protected]%7D">Scott Huntsman {[email protected]}</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. Link to comment https://forums.phpfreaks.com/topic/49607-regular-expression-help/ 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 Link to comment https://forums.phpfreaks.com/topic/49607-regular-expression-help/#findComment-243290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.