AVA正则表达式4种常用功能

正则表达式在字符串处理上有着强大的功能,sun在jdk1.4加入了对它的支持


  下面简单的说下它的4种常用功能

  查询:

   String str="abc efg ABC"; 
  String regEx="a|f"; //表示a或f

  Pattern p=Pattern.compile(regEx);

  Matcher m=p.matcher(str);

  boolean rs=m.find();

posted @ 2016-12-29 16:33  小小心脏  阅读(265)  评论(0编辑  收藏  举报