This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have a XML file which I parse and write the value of the node to a String. The XML tag is like,
<description>Search - Query Tab
Hide the Query Tab</description>
When I write this to a String I need to identify if there is any line feed in the given String and replace it with hard coded "\n" in it. (NOTE : Only if there is a line feed in it)
I tried to Pattern match to identify if there are any \r or \n.
descriptionBaseTerm is the <description> tag value
The if loop where I split the term using the same reg exp works fine returns the String as
"Search - Query Tab\n Hide the Query Tab". Which is the desired output.