fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String uri1 = "https://m...content-available-to-author-only...d.com/123/1234567890128/456/1111";
  13. String uri2 = "https://m...content-available-to-author-only...d.com/123/1234567890128";
  14. String uri3 = "https://m...content-available-to-author-only...d.com/123/1234567890128/456/111122222222222222222";
  15. String pattern = "https?://.*/123/[0-9]{13}(?:/456/[0-9]{1,20})?";
  16.  
  17. System.out.println(uri1.matches(pattern));
  18. System.out.println(uri2.matches(pattern));
  19. System.out.println(uri3.matches(pattern));
  20. }
  21. }
Success #stdin #stdout 0.13s 33864KB
stdin
Standard input is empty
stdout
true
true
false