protected function prepareRegexRule($value)
    {
        $escape = ['$' => '\$', '?' => '\?', '.' => '\.', '*' => '.*'];
        foreach ($escape as $search => $replace) {
            $value = str_replace($search, $replace, $value);
        }
        if (mb_strlen($value) > 2 && mb_substr($value, -2) == '\$') {
            $value = substr($value, 0, -2) . '$';
        }
        if (mb_strrpos($value, '/') == (mb_strlen($value) - 1)
            || mb_strrpos($value, '=') == (mb_strlen($value) - 1)
            || mb_strrpos($value, '?') == (mb_strlen($value) - 1)
        ) {
            $value .= '.*';
        }

	    if (substr($value, 0, 2) != '.*') {
		    $value = '^' . $value;
	    }
        return $value;
    }