Java 正则表达式最简单的例子

2015-02-26 0 493
Java 正则表达式最简单的例子
import java.util.regex.*;

public class Regex1{
  public static void main(String args[]) {
         String str="For my money, the important thing "+
         "about the meeting was bridge-building";
         String regEx="a|f";   //表示a或f 
         Pattern p=Pattern.compile(regEx);
         Matcher m=p.matcher(str);
         boolean result=m.find();
         System.out.println(result);
       }
}

遇见资源网 java Java 正则表达式最简单的例子 http://www.ox520.com/8750.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务