setParser() public method

This can be used for new parsers or overwriting existing ones.
public setParser ( string $name, string $pattern, string $replace, string $content ) : void
$name string Parser name
$pattern string Pattern
$replace string Replace pattern
$content string Parsed text pattern
return void
 /**
  * Adds emoticons
  * 
  * @return void
  */
 protected function addSmiles()
 {
     $path = $this->container->get('templating.helper.assets')->getUrl('/bundles/valantirforum/plugin/sceditor/emoticons/');
     foreach ($this->smiles as $smile) {
         $tag = '<img src="' . $path . $smile['file'] . '" alt="' . $smile['name'] . '">';
         $this->parser->setParser($smile['name'], $smile['pattern'], $tag, $smile['content']);
     }
 }
 public function testCustomParser()
 {
     $b = new BBCodeParser();
     $b->setParser('verybold', '/\\[verybold\\](.*)\\[\\/verybold\\]/', '<strong>VERY $1 BOLD</strong>');
     $result = $b->parse('[verybold]something[/verybold]');
     $this->assertEquals($result, '<strong>VERY something BOLD</strong>');
 }