gwkokab.analysis.utils.regex¶

Functions¶

match_all(→ Dict[str, int | float | None])

Match all strings in a list with a dictionary of regex patterns.

matches_regex(→ bool)

Check if a string matches a regex pattern.

Module Contents¶

gwkokab.analysis.utils.regex.match_all(strings: Sequence[str], pattern_dict_with_val: Dict[str, str | int | float | None]) Dict[str, int | float | None]¶

Match all strings in a list with a dictionary of regex patterns.

Parameters:
  • strings (List[str]) – list of strings to match

  • pattern_dict_with_val (Dict[str, str | int | float | None]) – dictionary of regex patterns with values

Returns:

dictionary of matched patterns with values

Return type:

Dict[str, int | float | None]

gwkokab.analysis.utils.regex.matches_regex(pattern: str, string: str) bool¶

Check if a string matches a regex pattern.

Parameters:
  • pattern (str) – regex pattern to match

  • string (str) – string to match

Returns:

True if the string matches the pattern, `code`:False: otherwise

Return type:

bool