Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
try ... except solution in Clear category for Unix Match. Part 2 by David_Jones
import re
def unix_match(filename, pattern):
pattern = pattern.replace('.', '\.') \
.replace('[!', '[^') \
.replace('[^]', '\[!]')
try:
return bool(re.match(pattern, filename))
except re.error:
return False
June 14, 2019
Comments: