Check compile_regex and return corresponding Regexp type