RUBY-698 Check compile_regex and return corresponding Regexp type