fork 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 s = "::a:b?:c??::d???????:e::";
  10. Pattern pattern = Pattern.compile("(?>\\?.|[^:?])+|(?<=:)(?=:)");
  11. Matcher matcher = pattern.matcher(s);
  12. while (matcher.find()){
  13. System.out.println("'" + matcher.group() + "'");
  14. }
  15. }
  16. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
''
'a'
'b?:c??'
''
'd???????:e'
''