I have last names in an XML file that I would like to capture, which are unique. I am going off this other StackOverflow answer to start: Only match unique string occurrences I am not able to match the strings that I have with this to return one Adams and one Yellow.
\b(.*<LastName>(.*)<\/LastName>)\b(?![\s\S]*\b\1\b)
<LastName>Adams</LastName>
<LastName>Adams</LastName>
<LastName>Yellow</LastName>