fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String s = "Hello a l l you guys";
  11. String key = "all";
  12. String pat = "(?i)\\b" + String.join("\\W*", key.split("")) + "\\b";
  13. System.out.println("Pattern: " + pat);
  14. Matcher m = Pattern.compile(pat).matcher(s);
  15. if (m.find())
  16. {
  17. System.out.println("Found: " + m.group());
  18. }
  19. }
  20. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
Pattern: (?i)\ba\W*l\W*l\b
Found: a l l