fork(9) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4.  
  5. class rTest {
  6. public static void main (String[] args) {
  7.  
  8. String s = "This is!just an:example,of a string,that needs?to be fixed.by inserting:a whitespace;after punctuation marks.";
  9. s = s.replaceAll("(?<=[,.!?;:])(?!$)", " ");
  10. System.out.println(s);
  11.  
  12.  
  13. }
  14. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
This is! just an: example, of a string, that needs? to be fixed. by inserting: a whitespace; after punctuation marks.