First of all, you should not use regex for this task. An HTML parser surely exists in whatever language you are using and is way better suited for this.
Now, if you need to use regex for whatever reason, you could use a negative lookahead if your implementation supports it. The expression
<w+(?![^>]*name)
identifies an opening HTML tag by <w+
and matches this only if the string "name" (enclosed by word boundaries) does not appear before the next closing bracket.
See it in action with RegExr.
This works only on well behaved HTML, and expanding it to respect quoted strings, javascript or comments will either be impossible or very very ugly. Did I mention HTML parsers? =)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…