Regex help -- cleaning up whitespace -- Java
- by FarmBoy
I'm trying to view the text of HTML files in a reasonable way. After I remove all of the markup and retain only the visible text, I obtain a String that looks something like this:
\n\n\n\n \n\n\n \n\n \n Title here \n\n\n \n\n \n\n Menu Item 1 \n\n \n\n Menu Item 2 \n\n\n \n\n you get the point.
I would like to use String.replaceAll(String regex, String regex) to replace any whitespace substring that contains more than two occurances of \n with "\n\n".
Any ideas?