问题
Possible Duplicates:
Changing ereg_replace to equivalent preg_replace
Converting ereg expressions to preg
Can anyone show me the equivalent of :
ereg_replace("\n#[^\n]*\n", "\n", $sql)
in preg_replace
Thanks
回答1:
All you need in this case is delimiters (here /
):
preg_replace("/\n#[^\n]*\n/", "\n", $sql)
Also read about the difference of PCRE from POSIX.
回答2:
preg_replace("~\n#[^\n]*\n~", "\n", $sql);
来源:https://stackoverflow.com/questions/6269616/ereg-replace-preg-replace-and-php-5-3-0