fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String s = "#!key1 #!compound.key2 #!super.compound.key3";
  10. Matcher matcher = Pattern.compile("(?<=#!)\\b\\w+(?:\\.\\w+)*").matcher(s);
  11. while (matcher.find()) {
  12. System.out.println(matcher.group());
  13. }
  14. }
  15. }
Success #stdin #stdout 0.07s 33980KB
stdin
Standard input is empty
stdout
key1
compound.key2
super.compound.key3