Expression : "\\<(\\S*).*?>.*?\\1>"
To make this work in java you have to set the dotall mode in pattern.
Pattern pattern =
Pattern.compile("\\<(\\S*).*?>.*?\\1>",Pattern.DOTALL);
*dotall mode means . also represents line terminator
Here \\< for < character, (\\S*) for any character which is not whitespace, .* for any character including whitespace (? for parsing Reluctant parsing. Please refer the Reluctant parsing in ) , > for that character, .* for any character including whitespace (? for parsing Reluctant parsing), for that character.