fork(1) download
  1. import java.util.regex.*;
  2.  
  3. /* Name of the class has to be "Main" only if the class is public. */
  4. class Ideone
  5. {
  6. public static void main (String[] args)
  7. {
  8. String s = "Hello world";
  9. Pattern p = Pattern.compile("(\\w)*");
  10. Matcher m = p.matcher(s);
  11.  
  12. while (m.find()) {
  13. System.out.println(s.substring(m.start(), m.end()));
  14. }
  15. }
  16. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Hello

world