$re = '/(?>{wrapper btnlabel=(?>"|")(.+?)(?>"|")})(.*?){\/wrapper}/s';
$str = '<p>{wrapper btnlabel="AAA"}zzzzzzzzzzzzzzzzzzzz{/wrapper}</p>
<p>{wrapper btnlabel="Text"}</p>
<table>
<tbody>
<tr>
<th scope="row">123</th>
<td>1 123</td>
<td>12 123</td>
<td>3 123</td>
<td>1 123 123</td>
</tr>
<tr>
<th scope="row">123</th>
<td>2700 123.</td>
<td>1800 123.</td>
<td>1000 123.</td>
<td>300 123.</td>
</tr>
</tbody>
</table>
<p>{/wrapper}</p>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php