https://stackoverflow.com/questions/1732348/regex-match-open...
The accepted answer is one that doesn’t care about the questioner‘s use case and instead gives a pretty excessive "Don‘t do it"
It does also give the right solution, using an xml parser.
We don’t know the use case.
Maybe the questioner is also in full control of the HTML creation and they don’t need a parser for all possible HTML edge cases.