fork 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 text = "one two, alpha9 12!done.";
  11. Pattern p = Pattern.compile("(?U)\\w+");
  12. Matcher m = p.matcher(text);
  13. while(m.find()) {
  14. System.out.println(m.group());
  15. }
  16. }
  17. }
Success #stdin #stdout 0.1s 48340KB
stdin
Standard input is empty
stdout
one
two
alpha9
12
done