I am having a bit of trouble removing a part of a string inside a text file with php.
I have a big file and i need to remove part of a line of this file.
The thing is the line is not always the same. It keeps the format but the numbers change. Here is an example:
< /td >This is the line< /td >and this< /td >is < /td >the < /td >part< /td >want to remove< /td >Name< /td > after it keeps going < /td > a loong way < /td >
I would like to remove from the < /td > after the word this until the < /td > after Name.
I was wondering if there is anyway of makin php delete backwards from name until the X number occurence from < /td >, something like:
Delete from Name until the 4th appearance of < /td >
Hope someone can help me....
Both answers below do the trick for the text but they dont work for my real code. So here is part of the real code:
... < /td >< /tr >< tr >< td onmouseover="dm.v(this,1);" onmouseout="dm.u(this);" id="mnFE0BBC45_i8" onclick="dm.ItClk(this,\'\');cmn.href(\'indexall.php\',\'\');" class="mn31BBMainMenuItemTD" >< table border="0" cellspacing="0" cellpadding="0" >< tr >< td class="mn31BBIconTD" > < font class="MG_Icons" >  746;< /font >< /td >< td class="mn31BBTitleTD" id="mnFE0BBC45_i8-tl" >Other_Name< /td >< td class="mn31BBArrowTD" > < /td >< /tr >< /table >< /td >< /tr >< tr >< td onmouseover="dm.v(this,1);" onmouseout="dm.u(this);" id="mnFE0BBC45_i3" onclick="dm.ItClk(this,\'\');cmn.href(\'index.php\',\'\');" class="mn31BBMainMenuItemTD" >< table border="0" cellspacing="0" cellpadding="0" >< tr >< td class="mn31BBIconTD" >< font class="MG_Icons" > 746;< /font >< /td >< td class="mn31BBTitleTD" id="mnFE0BBC45_i3-tl" >Name< /td > class="mn31BBArrowTD" < /td > /tr /table < /td >< /tr >< tr >< onmouseover="dm.v(th is,1);" onmouseout="dm.u(th is) ;" id="mnFE0B BC45_i5" oncli ck="dm.ItC lk(t his,\'\');cmn.h ref(\'indexd2.php\',\'\');" class...
This is only a little part of the code (is a Javascript Menu), there are spaces in all the tags (< tr >) to be able to see them....
The text i want to delete is:
< /td >< td class="mn31BBArrowTD" > < /td >< /tr >< /table >< /td >< /tr >< tr >< td onmouseover="dm.v(this,1);" onmouseout="dm.u(this);" id="mnFE0BBC45_i3" onclick="dm.ItClk(this,\'\');cmn.href(\'index.php\',\'\');" class="mn31BBMainMenuItemTD" >< table border="0" cellspacing="0" cellpadding="0" >< tr >< td class="mn31BBIconTD" >< font class="MG_Icons" > 746;< /font >< /td >< td class="mn31BBTitleTD" id="mnFE0BBC45_i3-tl" >Name
Both mnFE0BBC45_i3-tl and mnFE0BBC45_i3 are not always the same, the number changes depending of the Name.
That is way i want to do: Delete all from Name to the 4th appearence of < /td >
<td>
needs an opening and closing tag). Is this intentional? – rwacarter Jan 20 at 10:22