Golonka\BBCode\BBCodeParser::searchAndReplace PHP Method

searchAndReplace() protected method

Searches after a specified pattern and replaces it with provided structure
protected searchAndReplace ( string $pattern, string $replace, string $source ) : string
$pattern string Search pattern
$replace string Replacement structure
$source string Text to search in
return string Parsed text
    protected function searchAndReplace($pattern, $replace, $source)
    {
        while (preg_match($pattern, $source)) {
            $source = preg_replace($pattern, $replace, $source);
        }
        return $source;
    }