I have a XML read into a one single String. I need to get all the data inside <code> tags. I do not need to go though whole XML file parsing them. Can i use a simple string processing technique to get the data inside those tags.
input : <a><b><code>Hello</code></b><code>World</code></a>
output : Hello, World
"<code>(.*?)</code>"would match your code tags andmatcher.group(1)would contain the text. But be aware that this is not going to work (or needs way more complicated regexes) if the xml could be like< code attribute="something">or can contain<code>or other tags inside<code>etc. XML is not a regular language so there are cases that can't be done with regular expressions.