This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a multi line status xml out of which i need to extract the status value.
i cannot parse it as a xml and i have to use a pattern to extract the "ok" or"failed"(or it could be any other error code which i dont know in advance). can some one please help me to extract the value? I am a novice in regex and googling did not help me much.
Mahesh Mak wrote:Yes just the basics. I intend to leArn and use it more though.
Assuming that you know how to do basic matching -- matching the <status> tags along with the meta text in-between (using the find() method).... To extract the text in-between, setup a subgroup for it. You can then get the string with the group() method. See the java.util.regex.Pattern class for more info. See the section about groups and capturing.