Fixes regexp to better handle complex/nested markup