(name, mask)
return cregexp.match(name.upper()) is not None
Whether native name element matches DOS wildcard mask.
Whether native name element matches DOS wildcard mask.
Whether native name element matches DOS wildcard mask .
def dos_name_matches(name, mask):
    """Whether native name element matches DOS wildcard mask."""
    # convert wildcard mask to regexp
    regexp = b'\\A'
    for c in iterchar(mask.upper()):
        if c == b'?':
            regexp += b'.'
        elif c == b'*':
            # we won't need to match newlines, so dot is fine
            regexp += b'.*'
        else:
            regexp += re.escape(c)
    regexp += b'\\Z'
    cregexp = re.compile(regexp)
    return cregexp.match(name.upper()) is not None
def dos_name_matches ( name , mask ) : # convert wildcard mask to regexp regexp = b'\\A' for c in iterchar ( mask . upper ( ) ) : if c == b'?' : regexp += b'.' elif c == b'*' : # we won't need to match newlines, so dot is fine regexp += b'.*' else : regexp += re . escape ( c ) regexp += b'\\Z' cregexp = re . compile ( regexp ) return cregexp . match ( name . upper ( ) ) is not None