fork download
  1. import java.util.regex.Pattern;
  2.  
  3. class RegexIdiom
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. Pattern r = Pattern.compile("htt+p");
  8. boolean b = r.matcher("http://www.google.com").find();
  9. System.out.println(b);
  10. b = r.matcher("htttp").find();
  11. System.out.println(b);
  12. b = r.matcher("htp").find();
  13. System.out.println(b);
  14. }
  15. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
true
true
false