protected function execute($string)
    {
        foreach ($this->patternsAndReplacements as $patternAndReplacement) {
            $tmp = preg_replace("/".$patternAndReplacement->pattern."/s", $patternAndReplacement->replacement, $string);
            if ($tmp === null) {
                InvalidExpression::invalidRegex($patternAndReplacement->pattern, $patternAndReplacement->replacement);
            } else {
                $string = $tmp;
            }
        }
        
        return $string;
    }