- str_replace: documentation ( source)
- preg_replace: documentation ( source)
<?php
$str = '{download} button {download="hello"} {download=\'hey\'} assa {download="asa"}';
$str = str_replace('{download}', '{download="Download"}', $str);
$str = preg_replace(
'/\{download(\=\"(.*)\"|\=\'(.*)\'|)\}/siU',
'<a href="#" class="button">$2</a>',
$str);
echo $str;
?>