Categories
How to replace a link to another element in php?
It is necessary to change with regular expressions all links in a line, of the form to<a href="...">....</a>
<a href="...">....</a>
<tr><td><span> <a href="...">....</a> </span></td></tr>
Answer the question
In order to leave comments, you need to log in
$text = preg_replace('/<a\shref="([\S]+?)">([\S]+?)<\/a>/', '<tr><td><span> <a href="$1">$2</a> </span></td></tr>', $text);
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question