正则表达式中(?=X),(?!x),(?<=x)(?!x),是什么意思?怎么用啊?例如:Pattern p = Pattern.compile("(?<=a).{3}");
String s = "444a66b";
Matcher m = p.matcher(s);
while(m.find()) {
System.out.println(m.group());
}
他们分别输出结果是什么?最好解释一下!谢谢!
String s = "444a66b";
Matcher m = p.matcher(s);
while(m.find()) {
System.out.println(m.group());
}
他们分别输出结果是什么?最好解释一下!谢谢!
(?<!a) 表示这个间隙的前面除字符 a 的其他字符
(?=a) 表示这个间隙后面的字符应为 a
(?!a) 表示这个间隙后面为除 a 之外的其他字符(?<=),(?<!) 表示往前看,因此称为逆序
(?=),(?!) 表示往后看,因此称为顺序这个需要好好的理解,具体的可以看看我原来在下面这些帖子中的回复:正则表达式 环视问题
http://topic.csdn.net/u/20080619/08/e4d3ce39-6649-45e2-8f01-34e83161e108.html请解释一下正则的相关内容
http://topic.csdn.net/u/20080627/14/8a91b33a-f35c-4303-85b5-e0a8da462202.html确保字符串是1-100的数,怎么写正则?
http://topic.csdn.net/u/20080503/01/3c82b040-43b9-4b44-847d-07b366285957.html请详细解释一下你的正则表达式
http://topic.csdn.net/u/20080716/22/80cdd418-a0e9-4e7e-8435-df6d4bc11c4a.html