fork(2) 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 text = "The urn was then carried for several rounds around the cremation site, for the last leg of the procession.";
  10. Pattern pattern = Pattern.compile("[\\p{L}0-9]+", Pattern.UNICODE_CHARACTER_CLASS);
  11. Matcher matcher = pattern.matcher(text);
  12. List<String> result = new ArrayList<>();
  13. while (matcher.find()){
  14. result.add(matcher.group(0));
  15. }
  16. System.out.println(result);
  17. }
  18. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
[The, urn, was, then, carried, for, several, rounds, around, the, cremation, site, for, the, last, leg, of, the, procession]