[ create a new paste ] login | about

Link: http://codepad.org/sGmGj8S5    [ raw code | output | fork ]

PHP, pasted on Dec 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?
$myTable = '<table>
<tbody>
<tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    <th rowspan="3">I want to remove this</th>
</tr>

<tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td rowspan="3">I want to remove this</td>
</tr>
';
echo preg_replace("/<(?:td|th)[^>]*>.*?<\/(?:td|th)>\s+<\/tr>/i", "</tr>", $myTable);
?>


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
<table>
<tbody>
<tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    </tr>

<tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    </tr>


Create a new paste based on this one


Comments: