You can use the following regex:
<.+(class)=("|').+?\2.+?\1.+>
Escape the regex before you use it.
And if it matches
the string, then it contains duplicates. Else, it doesn't.
Explanation:
<.+(class)=("|')
matches the <
plus any characters till it reaches class=
single or double quotes.
The rest of the regex matches the value only if the string contains class
again somewhere along the line using backreference.