I am attempting to come up with a regular expression to remove a specific table row, or table column and replace it with something else. I am using preg_replace and an array of regular expressions.
Here is a sample of the code that needs to be changed:
<table width="100%" border="0" cellpadding="3" cellspacing="1" border="0" class="forumline" bgcolor=""#ffffff">
<tr>
<td class="row2" align="center"><div class="maintitle">{L_CONFIGURATION_TITLE}</div></td>
</tr><tr>
<td class="row2"><div class="genmed">{L_CONFIGURATION_EXPLAIN}</div></td>
</tr></table>
<form action="{S_CONFIG_ACTION}" method="post">
<table width="99%" cellpadding="3" cellspacing="1" border="0" align="center" class="forumline">
<tr>
<th colspan="2">{L_GENERAL_SETTINGS}</th>
</tr>
<tr>
<td class="row1" width="38%">{L_SERVER_NAME}</td>
<td class="row2" width="62%">
<input type="text" maxlength="255" size="40" name="server_name" value="{SERVER_NAME}" class="post" />
</td>
</tr>
<tr>
<td class="row1">{L_SERVER_PORT}<br />
<span class="gensmall">{L_SERVER_PORT_EXPLAIN}</span></td>
<td class="row2">
<input type="text" maxlength="5" size="5" name="server_port" value="{SERVER_PORT}" class="post" />
</td>
</tr>
Now what I want to do is to remove a table row that contains {SERVER_NAME}, just that row, or maybe JUST that column. This is what I have so far but it grabs the very first table row and deletes everything up to the ending /tr> after SERVER_NAME.
'<tr[^>]*?>.*?SERVER_NAME.*?</tr>'si
any help would be appreciated.
carl