A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© hzhzhen 中级黑马   /  2015-5-21 09:48  /  255 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. public static void main(String[] args) {
  2.                 // TODO Auto-generated method stub
  3.                 Pattern pat = Pattern.compile("<img src =.*alt=*>");
  4.                 @SuppressWarnings("resource")
  5.                 Scanner scanner = new Scanner(System.in);
  6.                 String input = scanner.nextLine();
  7.                 Matcher mat = pat.matcher(input);
  8.                 boolean resulet= mat.find();
  9.                 if (resulet == true){
  10.                         System.out.println("yes, i find it");
  11.                 }
  12.                 else
  13.                         System.out.println("no");
复制代码

我的输入是如下的:
<img src="img.iknow.bdimg.com/jctuijian/0721/jctj.jpg?t=1405910012" alt="">
为什么 输出不是yes?

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马