I am currently have a program that can find all the regexs that are in a string, however for a different part I want the parts that match the regex and the parts that don't. 

So if I had `<h1> hello world </h1>` I would want to be able to split it up into [`<h1>`, `hello world`, `</h1>`]. 

Does anyone have any ideas on how to they would go about this?

Here is my code that splits up the string to find the regex part

```
ArrayList<String> foundTags = new ArrayList<String>();
Pattern p = Pattern.compile("<(.*?)>");
Matcher m = p.matcher(HTMLLine);
while(m.find()){
    foundTags.add(m.group(0));
}

```