fork(2) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.Pattern;
  4. import java.util.regex.Matcher;
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Pattern pattern = Pattern.compile("(?:[^,/]+|/.)+");
  11. String test = "a,b/,b//,c///,//,d///,";
  12. Matcher matcher = pattern.matcher(test);
  13. while (matcher.find()) {
  14. System.out.println(matcher.group().replaceAll("/(.)", "$1"));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
a
b,b/
c/,/
d/,