For example: is replaced with
Seeking solutions.
preg_replace Regular expression search and replace
preg_replace
Using preg_replace, I wrote a simple example:
$b = ' <a href="http://tool.chinaz.com/" title="fish link">df</a> <a href="http://tool.chinaz.com/" title="no match">df</a> <a href="http://tool.chinaz.com/" title="fish link">df</a> '; var_dump(preg_replace('/<a.*title="fish link">/', '<a href="http://bbb.com" title="fish link">', $b));
output:
string(157) " <a href="http://bbb.com" title="fish link">df</a> <a href="http://tool.chinaz.com/" title="no match">df</a> <a href="http://bbb.com" title="fish link">df</a> "
preg_replace
Regular expression search and replaceUsing
preg_replace
, I wrote a simple example:output: