java正则表达式一些疑惑 Pattern pattern = Pattern.compile("[a-z]*"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String str = "abc";Pattern pattern = Pattern.compile("[a-z]?");Matcher matcher = pattern.matcher(str);while(matcher.matches()) { } import java.util.regex.Matcher;import java.util.regex.Pattern;public class Test { /** * * @param args */ public static void main(String[] args) { String str = "abc"; Pattern pattern = Pattern.compile("[a-z]", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(str); for (int i = 0; i < str.length(); i++) { if (matcher.find()) { System.out.println(matcher.group()); } } }}/**结果abc*/ public static void main(String[] args) { String str = "abc"; Pattern pattern = Pattern.compile("[a-z]",Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(str); while (matcher.find()) { System.out.println(matcher.group()); } }http://deerchao.net/tutorials/regex/regex.htm java menu 快捷键的问题 如何在程序中实现登陆? 在eclipse中运行applet程序显示图像不完全 请教java连接sqlserver2000抛出这个异常?Error establishing socket. 请教一道JAVA编程难题 JAVA打印纯文本文件的问题 求OptimalJ的下载地址~ 新瓶装老酒,给分不商量~ 简单的问题. weblogic6什么时候需要重新启动2! 关于URL问题,在线等 写一个自己的集合类
Pattern pattern = Pattern.compile("[a-z]?");
Matcher matcher = pattern.matcher(str);
while(matcher.matches()) {
}
import java.util.regex.Matcher;
import java.util.regex.Pattern;public class Test { /**
*
* @param args
*/
public static void main(String[] args) {
String str = "abc";
Pattern pattern = Pattern.compile("[a-z]", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(str);
for (int i = 0; i < str.length(); i++) {
if (matcher.find()) {
System.out.println(matcher.group());
}
}
}}/**结果a
b
c
*/
String str = "abc";
Pattern pattern = Pattern.compile("[a-z]",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
System.out.println(matcher.group());
} }
http://deerchao.net/tutorials/regex/regex.htm