docs: def pattern_to_regex(pattern: str) -> str:
      """ convert url patten to regex """
      if pattern and pattern[-1] == "*":
          pattern = pattern[:-1]
          end = ""
      else:
          end = "$"
      for metac in META_CHARS:
          pattern = pattern.replace(metac, "\\" + metac)
  
      return "^" + VARS_PT.sub(regex_replacer, pattern) + end