I want to replace all td's with th's for only the first tr. But I cannot really figure out how to do this using Regex in PHP. (replace the td at all)
<tr class="row0 row-hover">
<td class="column-0 "><?php _e('Data', 'domain'); ?> </td>
<td class="column-0 ">USD</td>
<td class="column-0 ">EUR</td>
<td class="column-0 ">GBP</td>
<td class="column-0 ">CAD</td>
<td class="column-0 ">CHF</td>
<td class="column-0 ">HKD</td>
<td class="column-0 ">AUD</td>
<td class="column-0 ">SGD</td>
<td class="column-0 ">SEK</td>
<td class="column-0 ">NOK</td>
<td class="column-0 ">CNH</td>
</tr>
First of all I have there markup.
I try to match them using <tr.*\(<td>).*\
. But that don't seem to work. I know that I have to firstly match on the (.*). But I cannot get the td's.
The second thing would be use the preg_replace
replace function. I saw that you can set here an $limit. So that would be just one? And what is the best way to group this for the preg_replace function?
It would be nice if it becomes this :)
<tr class="row0 row-hover">
<th class="column-0 "><?php _e('Data', 'domain'); ?> </th>
<th class="column-0 ">USD</th>
<th class="column-0 ">EUR</th>
<th class="column-0 ">GBP</th>
<th class="column-0 ">CAD</th>
<th class="column-0 ">CHF</th>
<th class="column-0 ">HKD</th>
<th class="column-0 ">AUD</th>
<th class="column-0 ">SGD</th>
<th class="column-0 ">SEK</th>
<th class="column-0 ">NOK</th>
<th class="column-0 ">CNH</th>
</tr>