java正则表达式找出不包含特定字符串
来源:互联网 发布:如何装修出租屋知乎 编辑:程序博客网 时间:2024/06/05 11:39
推荐文章:http://xixian.iteye.com/blog/1323630 和http://www.jb51.net/article/52491.htm
自己的经验是不能和正常的正则表达式一起混用。
代码如下:是不能正确判断的
public class Test {
public static void main(String[] args) {
String url ="http://so.xywy.com/zonghe.php?keyword=ganmao=2page";
String PdReg= "http://so.xywy.com/(zonghe|yisheng).php[?]keyword=.*^(?!.*page).*";
Pattern p1 = Pattern.compile(PdReg);
Matcher m = p1.matcher(url);
System.out.println(m.matches());
}
}
代码如下:结果是可以得
public class Test {
public static void main(String[] args) {
String url ="http://so.xywy.com/zonghe.php?keyword=ganmao=2page";
String PdReg= "http://so.xywy.com/(zonghe|yisheng).php[?]keyword=.*";
//^(?!.*page).*
Pattern p1 = Pattern.compile(PdReg);
Matcher m = p1.matcher(url);
System.out.println(m.matches());
}
}
代码如下:结果是可以得
public class Test {
public static void main(String[] args) {
String url ="http://so.xywy.com/zonghe.php?keyword=ganmao=2page";
String PdReg= "^(?!.*page).*";
//http://so.xywy.com/(zonghe|yisheng).php[?]keyword=.*
Pattern p1 = Pattern.compile(PdReg);
Matcher m = p1.matcher(url);
System.out.println(m.matches());
}
}
结论是两种形式不能混用
- java正则表达式找出不包含特定字符串
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目
- 使用正则表达式找出不包含特定字符串的条目概述
- 正则表达式,不包含字符串
- 正则表达式:不匹配特定的字符串
- 用正则表达式找出不包含连续字符串abc的单词
- java正则匹配字符串中不包含一个或几个特定的字符串
- 正则表达式 不包含指定字符串
- 不包含字符串abc的正则表达式
- 正则表达式判断不包含某字符串
- 正则表达式,不包含 字符串,regular expression
- 利用已知函数判断字符串是否为另一字符串的子串
- oracle 查询锁表 解锁
- MongoDB范围查询的索引优化
- 电脑进入BOOT MENU 按键总结!!!
- openal 简单实用
- java正则表达式找出不包含特定字符串
- 给出一个16位的二进制数
- 字符串水题 N - ?(>_o)!
- loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
- android开发过程中 R文件消失 clean 和 build project都无效 已解决
- mvc4文件上传由于文件太大而无法正常获取文件
- 2015阅读书单
- 自定义Layout用ViewGroup+ListView+GridView进行滑动事件拦截
- 参数估计