public function afterParse($content) {
        $smilies = $this->getSmilies();

        // Build the smilies regex
        $smiliesRegex = implode('|', array_map(function ($smile) {
            return preg_quote($smile, '/');
        }, $smilies));

        $pattern = sprintf('/(?:(?<=[\s.;>:)])|^)(%s)/', $smiliesRegex);
        $content = preg_replace_callback($pattern, array($this, '_emoticonCallback'), $content);

        $pattern = sprintf('/(%s)(?:(?=[\s.&<:(])|$)/', $smiliesRegex);
        $content = preg_replace_callback($pattern, array($this, '_emoticonCallback'), $content);

        return $content;
    }