Ashish Mishra wrote:Need some help on how to compile this string by using delimiters "two blank lines" and get each message block in my scanner without those lines.
What you're doing seems awfully tortuous to me. Why not just use nextLine() to read your lines?
Then your pattern will be perfect for checking for blank lines (in fact, I prefer yours to Harsha's) except that you don't need the "\\n" (Scanner.nextLine() doesn't return it); and if you get two of them, you know that the next line must be the start of a new log entry.
The other problem with the way you're currently doing it is that unless you do further processing you'll get a multiline string with embedded newlines in it for your log data. While regex patterns can be set up to deal with multiple lines, they generally work best with single line input.
Isn't it funny how there's always time and money enough to do it WRONG?
Joined: Jul 18, 2011
But doesn't meet client's requirements of matching 2 blank lines, useDelimiter, hasNext()