Jun-07-2022, 09:38 PM
The ! is a logical NOT
re docs:
fnmatch was conceived as a Unix file name matcher. Maybe better to stick with re.
re docs:
Quote:(?=...)
Matches if ... matches next, but doesn’t consume any of the string. This is called a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if it’s followed by 'Asimov'.
(?!...)
Matches if ... doesn’t match next. This is a negative lookahead assertion. For example, Isaac (?!Asimov) will match 'Isaac ' only if it’s not followed by 'Asimov'.
fnmatch was conceived as a Unix file name matcher. Maybe better to stick with re.