pub(crate) fn from_string(globals: &mut Globals, reg_str: &str) -> Result<Self, Error> {
        let conv = Regex::new(r"\\Z\z").unwrap();
        let reg_str = if let Some(mat) = conv.find(reg_str).unwrap() {
            let mut s = reg_str.to_string();
            s.replace_range(mat.range(), r"\z");
            s
        } else {
            reg_str.to_string()
        };
        match globals.regexp_cache.get(&reg_str) {
            Some(re) => Ok(RegexpInfo(re.clone())),
            None => {
                let regex = Rc::new(Regex::new(&reg_str)?);
                globals
                    .regexp_cache
                    .insert(reg_str.to_string(), regex.clone());
                Ok(RegexpInfo(regex))
            }
        }
    }
Create `RegexpInfo` from `reg_str`.
The first `\\Z\z` in `reg_str` is replaced by '\z' for compatibility issue
between fancy_regex crate and Regexp class of Ruby.
ruruby/src/builtin/regexp.rs