Pattern pattern = Pattern.compile("[a-z]*"); 

解决方案 »

  1.   

    String str = "abc";
    Pattern pattern = Pattern.compile("[a-z]?");
    Matcher matcher = pattern.matcher(str);
    while(matcher.matches()) {
               } 
     
      

  2.   


    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
    */
      

  3.   

    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