publicstaticvoid main (String[] args)throws java.lang.Exception
{
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 %>";
s = s.replaceAll("(%>\\R*|\\G\\R*(?!<%)).", "$1 ");