Just remove the first and last \\b then remove the backslash which exists before /
Pattern p = Pattern.compile("(<InstanceIdentifier>\\b)(.*?)(\\b</InstanceIdentifier>)");
or
Pattern p = Pattern.compile("<InstanceIdentifier>\\b(.*?)\\b</InstanceIdentifier>");
Matcher m = p.matcher(s);
if(m.find())
{
System.out.println(m.group(1));
}
Note that \\b matches between a word character and a non-word character, so the above regex must except a word character next to the starting INstanceIdentifier tag and before the closing INstanceIdentifier tag.
Your regex fails because there isn't a word character character which actually exists between the start of the line and the opening < bracket , likewise there isn't a word character which exists next to > and end of the line boundary. In this case, adding \\B instead of \\b at the start and end should work.