I think you meant to capture the content between tags than splitting the string.
It's well known that you should NOT use a regex to parse xhtml since you can get w͈̦̝͉̬͔͕͡ͅe̴͏̰̜͖̗̤̙̖̕i̧̩̭̳̱̖̦͠ͅŗ̴̼̺̻͕̀d̶̩̖̦̖̲̣̺̫͘ ̡͇̥̩͓c͕̻̫͉̞͝ͅo̯̗͜͜͝ṇ̠͘t̛̬̮̞̥͕̙̞e̷̸̗̼͟ͅn̡͎̖̜̱͟͢t̨̙̫̻̱̺͈̗͝. Although, if you still want a regex you can use a regex like this:
<CHAR>(.*?)<\/CHAR>
Working demo
And you can have this java code:
String line = "<MSG><KEY>name.extObject</KEY><PARAM><CHAR>Number</CHAR><CHAR>7015:188188</CHAR></PARAM></MSG>";
Pattern pattern = Pattern.compile("<CHAR>(.*?)<\\/CHAR>");
Matcher matcher = pattern.matcher(line);
String result = "";
while (matcher.find()) {
result += matcher.group(1) + " ";
}
System.out.println(result); //Prints: Number 7015:188188
Update: as Pshemo pointed in his comment:
/
is not special character in Java regex engine. You don't have to escape it
So, you can use:
Pattern pattern = Pattern.compile("<CHAR>(.*?)</CHAR>");
Btw, I really like Pshemo answer, it's a nice approach to solve this without regex and xhtml