Create regex from glob expression

no need for incomplete or unreliable hacks. there’s a function included with python for this

>>> import fnmatch
>>> fnmatch.translate( '*.foo' )
'.*\\.foo$'
>>> fnmatch.translate( '[a-z]*.txt' )
'[a-z].*\\.txt$'

Leave a Comment