UniCoreFW

is_reg_exp()

Check if obj is a regular expression.

Implementation

Args: obj: The object to check Returns: True if obj is a regular expression, False otherwise

Example

is_reg_exp(re.compile('.*'))

Expected output: True

Source Code

def is_reg_exp(obj: Any) -> bool: return isinstance(obj, re.Pattern)