Home  >  Article  >  Backend Development  >  php 正则 不允许出现某字符,该如何处理

php 正则 不允许出现某字符,该如何处理

WBOY
WBOYOriginal
2016-06-13 11:16:42810browse

php 正则 不允许出现某字符
比如我原先的正则:
[\s\S]*?

问题来了,中间获取到另外一段包含的字符。想实现ignore_js_op这个字符串不再包含在里面,如何写?


------解决方案--------------------
用preg_replace_callback()先匹配后替换到里面出现的
------解决方案--------------------
那就别用正则,换用dom来解析。
http://php.net/manual/en/book.dom.php

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