fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. final String re =
  9. "^https?://(?:www\\.)?(?:google|facebook)\\.com/(?!.*?\\.(?:jpe?g|png|bmp|gif)\\b).*$";
  10. String str = "http://www.google.com/logo.pngdd";
  11. System.out.printf("%s%n", str.matches(re));
  12.  
  13. str = "http://www.google.com/logo.png";
  14. System.out.printf("%s%n", str.matches(re));
  15.  
  16. str = "https://w...content-available-to-author-only...k.com/news";
  17. System.out.printf("%s%n", str.matches(re));
  18. }
  19. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
true
false
true