fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Ideone
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String s = "\"Test Line wo line break\"; \"Test Line \nwith line break\"\n\"Test Line2 wo line break\"; \"Test Line2 \nwith line break\"";
  9. Matcher m = Pattern.compile("\"[^\"]*\"").matcher(s);
  10. s = m.replaceAll(r -> m.group().replaceAll("\\R+", ""));
  11. System.out.println(s);
  12. }
  13. }
Success #stdin #stdout 0.08s 44096KB
stdin
Standard input is empty
stdout
"Test Line wo line break"; "Test Line with line break"
"Test Line2 wo line break"; "Test Line2 with line break"