goalie.is_matching_regex

goalie.is_matching_regex(x: object, pattern: str) bool

Check whether the string matches a regex pattern.

Parameters:
  • x (object) – Value to check.

  • pattern (str) – Regular expression pattern.

Returns:

True if x is a string and matches pattern.

Return type:

bool

Examples

>>> is_matching_regex("foobar", "^f")
True
>>> is_matching_regex("foobar", "^b")
False