Bug 2655 – Allow alternation patterns in std.path.fnmatch

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2009-02-11T21:58:00Z
Last change time
2014-03-01T00:36:00Z
Assigned to
andrei
Creator
wbaxter

Attachments

IDFilenameSummaryContent-TypeSize
289fnmatch.dfnmatch function enhanced with {,} patternstext/x-dsrc6819

Comments

Comment #0 by wbaxter — 2009-02-11T21:58:51Z
It would be nice if fnmatch also supported the standard alternaltion syntax for wildcards, where "abc.{def,ghi}.jkl" matches either abc.def.jkl or "abc.gji.jkl". Attached is a modified version of the function that does that. Like the current implementation, the additions lack an escape syntax. So it's not possible to match filename with a literal ',' or '{'. (Just like the current function is unable to match a literal '[', '*' or '?' in a filename)
Comment #1 by wbaxter — 2009-02-11T22:00:09Z
Created attachment 289 fnmatch function enhanced with {,} patterns
Comment #2 by andrei — 2010-09-26T13:03:09Z
Included with credit the proposed function and unittest, with minor changes. Thanks! http://www.dsource.org/projects/phobos/changeset/2058