private function createRegex($eventPattern)
    {
        $replacements = self::getReplacements();

        return sprintf('/^%s$/', preg_replace(
            array_keys($replacements),
            array_values($replacements),
            preg_quote($eventPattern, '/')
        ));
    }