Home > Backend Development > PHP Tutorial > php 正则 不允许出现某字符解决思路

php 正则 不允许出现某字符解决思路

WBOY
Release: 2016-06-13 12:52:31
Original
996 people have browsed it

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

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


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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template