Home  >  Article  >  Backend Development  >  正则表达式后向引用,该如何解决

正则表达式后向引用,该如何解决

WBOY
WBOYOriginal
2016-06-13 10:07:50968browse

正则表达式后向引用

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$reg = "/(\d{2})\/(\d{2})\/(\d{4})/e";$text = '01/25/2009到02/02/2009';$replace = "\${3},\${1}";echo preg_replace($reg, $replace, $text);


报错:syntax error, unexpected ','
如果将逗号去掉,输出“200901到200902 ”
把逗号换成别的符号也都会报错~

------解决方案--------------------
把e去掉
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn