fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String inputText = "I want to know relating to cloud based erp services.";
  11. Set<String> words = new HashSet<String>();
  12. words.add("erp");
  13. words.add("cloud");
  14.  
  15. Pattern p = Pattern.compile("^(?=.*" + String.join(")(?=.*", words) + ")", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
  16. System.out.println(p.toString());
  17.  
  18. Matcher m = p.matcher(inputText);
  19. if (m.find())
  20. {
  21. System.out.println("Yes we providing it.");
  22. }
  23. }
  24. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
^(?=.*cloud)(?=.*erp)
Yes we providing it.