I have an input from an HTML table. First replacing wanted spacing by '_'. Then replacing HTML tags by spacing so I can extract the information by column.
I want my output to be:
100 Request_in_progress Pending_response 789653686
Instead the output adds extra spacing like this
$testString = '<tr><td>100</td><td>Request in progress</td><td></td><td></td><td>Pending response</td><td>789653686</td><td></td><td></td><td></td></tr>';
$rmSpace = str_replace(' ', '_', $testString);
$tags = '(<td>||</td>||<tr>||</tr>||<th>||</th>)';
$result = preg_replace($tags, ' ', $rmSpace);
echo $result;