RegEx to Completely Remove BBCode in Text.php


Well-known member
I have an application where I have a custom BBCode to insert some meta data into a post. For the thread preview and/or the meta page description I need to completely remove that tag.

The tag itself is something like this..
<meta itemprop="property" content="MIXEDVALUE">
In BbCode/Formatter/Text.php I have this code..
tags['tagname'] = array(
   'hasOption' => true,
   'optionRegex' => '/([A-Z])\w+/',
   'replace' => array('<meta itemprop="property" content="\'%s\'', '"\/>')
That code does strip everything except the MIXEDVALUE.

Which I don't exactly understand because the 'optionRegex' does match the MIXEDVALUE perfectly.

What am I missing here?

EDIT: The other part in Text.php is this...
public function handleTagTagname(array $tag, array $rendererStates)
       $output = $this->renderSubTree($tag['children'], $rendererStates);
       return "";
Last edited:


Well-known member
The text.php does not work quite the way I thought it did. I found that the snippet template helper is a better way to go.