the-botman Posted December 6, 2009 Share Posted December 6, 2009 hey guys ok see i need to replace everything inbetween this to tags and replace it with just a <br> p class="potMatchMenuText"> anything can be here more text or tags untill here<p class="potMatchHeading"> this is how it might show <p class="potMatchMenuText"><span class="cardMenu">Scorecard |</span> <span class="cardMenu">Commentary |</span> <span class="cardMenu">3D animation |</span> <span class="cardMenu">Article index (15) |</span> <span class="cardMenu">Photo index (60)</span> </p> <p class="potMatchHeading"> Thanks in advance Botman Quote Link to comment Share on other sites More sharing options...
the-botman Posted December 6, 2009 Author Share Posted December 6, 2009 will this work? $tags = array('<p class="potMatchMenuText">','</p>'); $getmydata = str_replace($tags, '', $getmydata); Quote Link to comment Share on other sites More sharing options...
salathe Posted December 6, 2009 Share Posted December 6, 2009 Before posting a regular expression, can I just check that your desired output is: <p class="potMatchMenuText"><br><p class="potMatchHeading"> I only ask because it looks like that will break the HTML structure! Quote Link to comment Share on other sites More sharing options...
the-botman Posted December 6, 2009 Author Share Posted December 6, 2009 i got it $pattern = '%<p class="potMatchMenuText">(.+?)</p>%is'; $getmydata = preg_replace($pattern, '$2', $getmydata); thanks Quote Link to comment Share on other sites More sharing options...
cags Posted December 7, 2009 Share Posted December 7, 2009 Can I ask why your using $2 as the replacement pattern? Since you don't have a second capture group you are essential just replacing with a null string, so why not just use ''? 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.