Package com.firefly.utils.pattern

Examples of com.firefly.utils.pattern.Pattern.match()


    Assert.assertThat(p.match("http://www.fireflysource.com/cn/app")[0], is("http://"));
    Assert.assertThat(p.match("http://www.fireflysource.com/cn/app")[3], is(""));
    Assert.assertThat(p.match("http://www.fireflysource.com/cn/app/1334")[3], is("/1334"));
   
    p = Pattern.compile("abc*abc", "*");
    Assert.assertThat(p.match("abcabcabc")[0], is(""));
   
    p = Pattern.compile("aa*aa", "*");
    Assert.assertThat(p.match("aaaaa")[0], is(""));
  }
 
View Full Code Here


   
    p = Pattern.compile("abc*abc", "*");
    Assert.assertThat(p.match("abcabcabc")[0], is(""));
   
    p = Pattern.compile("aa*aa", "*");
    Assert.assertThat(p.match("aaaaa")[0], is(""));
  }
 
  public static void main(String[] args) {
    int times = 10000000;
   
View Full Code Here

    System.out.println("regex reluctant: " + (System.currentTimeMillis() - start));
   
    // 简单匹配
    start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      p2.match("http://www.fireflysource.com/cn/app/1334");
    }
    System.out.println("simple: " + (System.currentTimeMillis() - start));
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.