dict_from_regex_match

dict_from_regex_match#

tollan.utils.dict.dict_from_regex_match(pattern: str | Pattern, string: str, type_dispatcher: dict[str, Any] | None = None) dict[str, Any] | None[source]#

Return a dict from matching pattern to string.

If match failed, returns None.

Parameters:
  • pattern (str, re.Pattern) – The regex that matches to the input_.

  • input (str) – The string to be matched.

  • type_dispatcher (dict) – This specifies how the matched group values are handled after being extracted.