<div(?=\s)
(?:
(?!\sid=|>)
.
)* # Consume everything until finding " id=" or ">"
# (">" is just for failing faster)
\sdiv=(?P<__quote>['"])? # Consume " div=" and save the quote type (' or ") if any
(?: # while
(?! # next character isn't,
(?(__quote) # if a quote has been opened,
(?P=__quote) # the closing quote ;
|[\s>] # a space or ">" else,
)
)
. # consume this character
)*
(?(__quote) # If we got a quote
(?P=__quote)| # it must be closed
(?=[\s>]) # else, the attribute is ended by a space or ">"
)
[^>]*> # Consume the rest of the tag