Usually they .*are greedy matches, they will match as much as they can, followed by a match. Since an empty string matches a match for (?!txt), it .*will simply match the entire string, which means that this regular expression will match every string.
.*\.txt$ re.match .
, re.match, regex . , . re, , , , re.match . , , "", , , , . EOL .