fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String s = "not important stuf\n f <not important stuff>\n\n <% some important text %> something <% important stuff %>\n not important stuf\n f <not important stuff>\n <% some\n important text\n %>";
  10. s = s.replaceAll("(%>\\R*|\\G\\R*(?!<%)).", "$1 ");
  11. System.out.println(s);
  12. }
  13. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
                  
                        

 <% some important text %>           <% important stuff %>
                   
                        
 <% some
        important text
 %>