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.
I have done it the same way as you have quoted.
But I was wondering why Pattern Matcher didnt work.Also wanted to know if there are any other syntax to find line feed using Patterns.
Matcher.matches() checks whether the entire region is matched by the regexp, not whether the pattern matches anywhere in the region; Matcher.find() does that.
Ulf Dittmer wrote:Matcher.matches() checks whether the entire region is matched by the regexp, not whether the pattern matches anywhere in the region; Matcher.find() does that.
Hmm, I missed that .. Thanks Ulf.
Post by:autobot
Your mother is a hamster and your father smells of tiny ads!
a bit of art, as a gift, that will fit in a stocking