3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reg_exp = "/(^<table.+.(?:[n])?(?:.+)?)(<tbody>)/s"; $replace_with = '/1<thead>'; $input = '<table class="table table-bordered table-responsive" style="width: 100%;"> <tbody>'; $final = preg_replace($reg_exp, $replace_with, $input); var_dump($final);

preferences:
46.07 ms | 402 KiB | 5 Q