Shell style globbing instead or re syntax?

bruce edge bruce_edge at yahoo.com
Tue Aug 13 19:23:49 CEST 2002


On Tue, 13 Aug 2002 09:32:25 -0700, Daniel Dittmar wrote:

> bruce edge wrote:
>> I'd doing a command line interface thingy in python. I want to support
>> expressions for args, while I like python's re syntax, it's not what
>> users expect.
>> They're more used to bash style globbing. Is there a lib somewhere that
>> I can use for this?
>> glob doesn't work because it only works on filenames.
> 
> Use fnmatch.translate:
> def translate(pat):
>     """Translate a shell PATTERN to a regular expression.
> 
>     There is no way to quote meta-characters. """
> 
> Daniel

Woo Hoo! Exactly what I needed, Thanks!



More information about the Python-list mailing list