I got this pattern to work, finding incorrect lines 2 and 5 as you requested:
>>> import re
>>> p = r'<[a-z]+\s[a-z]+=[\'\"][\w;:]*[\"\'][\w]+.*'
>>> html = """
<div style="margin:37px;"/></div>
<span title=''style="margin:37px;" /></span>
<span title="" style="margin:37px;" /></span>
<a title="u" hghghgh title="j" >
<a title=""gg ff>
"""
>>> bad = re.findall(p, html)
>>> print '\n'.join(bad)
<span title=''style="margin:37px;" /></span>
<a title=""gg ff>
regex broken down:
p = r'<[a-z]+\s[a-z]+=[\'\"][\w;:]*[\"\'][\w]+.*'
<
- starting bracket
[a-z]+\s
- 1 or more lowercase letters followed by a space
[a-z]+=
- 1 or more lowercase letters followed by an equals sign
[\'\"]
- match a single or double quote one time
[\w;:]*
- match an alphnumeric character (a-zA-Z0-9_) or a colon or semi-colon 0 or more times
[\"\']
- again match a single or double quote one time
[\w]+
- match an alphanumeric character one or more times(this catches the lack of a space you wanted to detect) ***
.*
- match anything 0 or more times(gets rest of the line)