I am looking for duplicate attributes within the code base, I threw an expression together that works, but I am wondering if it can be made any simpler or more logical.
Sample input
test.append("<td class='no-order' style='text-align:center;' class=\"data text\">");
My attempt
<([^>]*)(class=('|\\")[^('|\\")]+('|\\"))([^>]*)(class=('|\\")[^('|\\")]+('|\\"))([^>]*)>
My thinking was looking for a start tag <
then anything that is not an end tag [^>]*
followed by a class attribute with either '
or \"
and then repeating the whole thing.
As you can see, even though it works, it looks quite long and complicated, is their a simpler way?
Edit:
super bonus brownie points for whoever writes it in the form of a replace all, so it combines the attribute values after running