PHP regular expression error analysis

preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash


<?php
$str="[url]halown.com[/url]";
$str=preg_replace("#\[url\](.*)\[/url]#","http://$1",$str);
echo $str;
?>

Among them, # is the Delimiter of the first parameter. If it is not added, an error will be reported.

Guess you like

Origin blog.csdn.net/jjiale/article/details/46331853