编写程序,熟悉正则表达式

import java.util.regex.*;

public class RegExp{
    
    public static void main(String[] args){
        
        System.out.println("32323232@qq.com".matches("[\\w[.-]]+@[\\w[.-]]+\\.\\w+"));
        System.out.println("a23544c".replaceAll("\\d","_"));
        
        Pattern p = Pattern.compile("-[a-z]{3}");
        Matcher m = p.matcher("-agh-sfg-rgh");
        System.out.println(m.matches() + " " + m.find() + " " + m.end() + " " + m.lookingAt() + " " + m.find() + " " + m.start());
        
        System.out.println("a".matches("a*"));
    }
    
}

 

posted @ 2020-04-02 11:14  yxfyg  阅读(175)  评论(0)    收藏  举报