我一个正则表达式,如何判定里面不包含某个内容的_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:47:00
Original
1948 people have browsed it

本帖最后由 qq914260102 于 2013-11-06 15:06:27 编辑

比如:我要写一个正则表达式,不包含,"正确"两个字的(不正确、不正确的)的这种情况也要考虑进去。

如果反过来,必须元包含"正确"两个字的(不正确、不正确的)的这种情况也要考虑进去。
又该怎么写呢。

回复讨论(解决方案)

str.indexOf("正确")==-1不包含 反之包含

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script type='text/javascript'>	var reg=/正确/;	alert(reg.test("我鹅鹅鹅正确的"));	alert(reg.test("我鹅鹅鹅四十四"));</script>
Copy after login

这个是包含正确,不包含if(!reg.test("我鹅鹅鹅正确的"))

(?!(?:正确)).*

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!