How to check in a regular expression on the existence of a certain attribute and, if it exists, perform manipulations, if not, then do not. You can do this type:
preg_replace("#\[font|font size=(1|2|3)\](.+?)\[\/font\]#is", "...", $text);
But the size attribute may or may not be transferred. Also, it will be necessary to verify the value of the attribute if it was passed:
switch($size){ case '1': $f='font-style:10pt;'; case '2': $f='font-style:11pt;'; }
Tell me how it is possible to implement?