adding ".*?" To a answer makes it non greedy running <h2)*?> on <h2 style="text-align: center;">heading</h2> will return <h2 style="text-align: center;">