fnmatch/glob with sub-expressions
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.
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@pythoncraft.com) <*> http://www.pythoncraft.com/ Adopt A Process -- stop killing all your children!
participants (2)
-
Aahz
-
Erick Tryzelaar