def ismatch ( text , pattern ) : if hasattr ( pattern , 'search' ) : return pattern . search ( text ) is not None else : return pattern in text if Config . options . case_sensitive else pattern . lower ( ) in text . lower ( )
python if matches text
Test whether text contains string or matches regex .
def ismatch(text, pattern):
    """Test whether text contains string or matches regex."""

    if hasattr(pattern, 'search'):
        return pattern.search(text) is not None
    else:
        return pattern in text if Config.options.case_sensitive \
            else pattern.lower() in text.lower()