See [this SO post](https://stackoverflow.com/questions/78574784/how-to-make-sure-element-has-parsing-precedence-before-other-elements-in-pyparsi), should be able to use match_previous_expr to enforce matching of opening and closing tags. Does not work for nested tags.