Hi Adrian. You might want to use a capturing group. You could do it with the following generalized regex:This will match input beginning with a <> opening tag, followed by any number of characters, followed by a closing tag that has the same name as the opening tag.
If you find this match, you can use matcher.group(1) to find the name of the tag, and if it equals "Data1", you can use matcher.group(2) to get the content of the element.
Here is some example code:
Note that this will not work if you have nested elements with the same name. If this is the case, you will have to use more than just a regex to solve your problem. The example regex I gave also does not take into account white space, and other special conditions.
Take a good look at the description of the Pattern class. If you have questions, don't hesitate to ask.