fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.*;
  7.  
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Set<String> patterns = new HashSet<String>(Arrays.asList("title@*", "text@*", "specification*/specificationText"));
  13. String abc = "specification1/specificationText";
  14. System.out.println(isMatch(abc, patterns));
  15. }
  16. private static Boolean isMatch(String abc, Set<String> patterns) {
  17. for (String pattern : patterns) {
  18. if (abc.matches(pattern.replace("*", "(.*)"))) {
  19. return true;
  20. }
  21. }
  22. return false;
  23. }
  24. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
true