This question already has an answer here:
I want to replace '<tbody>'
with '<thead>'
form:
<table class="table table-bordered table-responsive" style="width: 100%;">
<tbody>
And Here is my code:
$reg_exp = "/(^<table.+.(?:[n])?(?:.+)?)(<tbody>)/";
$replace_with = "/1<thead>";
echo $input = '<table class="table table-bordered table-responsive" style="width: 100%;">
<tbody>';
$final = preg_replace($reg_exp, $replace_with, $input);
var_dump($final);
It prints:
string(83) "<table class="table table-bordered table-responsive" style="width: 100%;">
<tbody></tbody></table>
I can't figure out whats wrong! Please, someone can guide me on how i can do this? Thanks
</div>