fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.regex.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Pattern p = Pattern.compile("(?=(a?bc))(?=(ab?c))(?=(abc?)).*");
  10. Matcher m = p.matcher("abcdef");
  11. if (m.matches()) {
  12. System.out.printf("%s::<%s> <%s> <%s>%n", m.group(), m.group(1), m.group(2), m.group(3));
  13. }
  14. }
  15. }
Success #stdin #stdout 0.09s 380224KB
stdin
Standard input is empty
stdout
abcdef::<abc> <abc> <abc>