I *want* to replace newlines.
Then the same basic architechture would apply. You would just need to look ahead as many lines as necessary to find your matches. You could even read the whole file into one big
String which would make parsing much easier but might run the risk of an OutOfMemory error.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher