Regex is overkill for this. Just split the input string on '<' and '>'.