Depends on what you are trying to do, but I'd probably say this is closer to what you want. $pattern = '/<h3 class=r>.*<\/h3>/'; Code (markup):
Accounts for other HTML like <span> inside the <h3> '#<h3 class=r>(.+(?!/h3>))</h3>#i' Code (markup): Assumes there's no HTML inside the <h3> '#<h3 class=r>([^<]+)</h3>#i' Code (markup): It would be best if you posted as many examples of what this should be matched against as possible.