在java里是有正则表达式的实现, 如果我想自己实现,比如:我要匹配:[a-z]if(x>='a' && x<='z')
   match(x);
else
   take away;那位有源码?或者知道那里有源码学习一下?

解决方案 »

  1.   

    "^[A-Za-z]+$"  //由26个英文字母组成的字符串 "^[A-Z]+$"  //由26个英文字母的大写组成的字符串 "^[a-z]+$"  //由26个英文字母的小写组成的字符串 "^[A-Za-z0-9]+$"  //由数字和26个英文字母组成的字符串 "^\w+$"  //由数字、26个英文字母或者下划线组成的字符串
      

  2.   

    public Matcher matcher(CharSequence input) {
            synchronized(this) {
                if (!compiled)
                    compile();
            }
            Matcher m = new Matcher(this, input);
            return m;
        }
      

  3.   

    Pattern p = Pattern.compile("[a-z]"); 
    p.matcher().match("参数");