fork(29) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String s = "Input one Input Two Input Three";
  9. Pattern pat = Pattern.compile("Input(.*?)(?=Input|$)");
  10. Matcher m = pat.matcher(s);
  11.  
  12. while (m.find()) {
  13.  
  14. System.out.println(m.group(1));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.05s 213440KB
stdin
Standard input is empty
stdout
 one 
 Two 
 Three