• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RegEx to Completely Remove BBCode in Text.php

Snog

Well-known member
#1
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..
Code:
<meta itemprop="property" content="MIXEDVALUE">
In BbCode/Formatter/Text.php I have this code..
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...
Code:
public function handleTagTagname(array $tag, array $rendererStates)
{
       $output = $this->renderSubTree($tag['children'], $rendererStates);
       return "";
}
 
Last edited:

Snog

Well-known member
#2
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.