protected function prepareMysqlRegexp($string)
    {
        $regexp = $string;

        // first remove trailing increment
        $regexp = preg_replace('/\([0-9]\)$/', "", $regexp);

        // escape existing parenthesis
        $regexp = preg_replace('(\(|\))', '\\\\${0}', $regexp);

        // append matching mysql matching pattern
        $regexp .= "([[.left-parenthesis.]][0-9]*[[.right-parenthesis.]])*$";

        return $regexp;

    }