[Python-ideas] fnmatch/glob with sub-expressions
Aahz
aahz at pythoncraft.com
Mon Jul 21 00:55:41 CEST 2008
On Sun, Jul 20, 2008, Erick Tryzelaar wrote:
>
> I need to handle more advanced glob pattern matching than what
> glob/fnmatch provides. I need to support patterns like this:
>
> "a{b*c,d[ef]}" -> "a(b.*c|d[ef])$"
> "a{b{c,d},e}" -> "a(b(c|d)|e)$"
>
> This syntax is used in many shells, like bash and zsh, and other
> languages, like ruby. Does anyone else think this might be worthwhile
> in the standard library? It's a pretty simple change, but it could
> break code though, so we'd probably have to disable it by default.
Patches are probably welcome, but I think most people use os.listdir()
combined with re to handle such matching. (That's certainly what I do.)
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Adopt A Process -- stop killing all your children!
More information about the Python-ideas
mailing list