Filter strings by first cutting out a region (include) and then selectively remove (exclude) from that region.
I often use this in my programs to allow a user to specify what files to process and the have some control over what to exclude.
The regular expressions are set to ignoring the case.
Example:
import std.algorithm : filter; import std.array : array; auto r = GlobFilter(["foo*"], ["*bar*", "*batman"]); assert(["foo", "foobar", "foo smurf batman", "batman", "fo", "foo mother"].filter!(a => r.match(a)).array == [ "foo", "foo mother" ]);
See Implementation
Filter strings by first cutting out a region (include) and then selectively remove (exclude) from that region.
I often use this in my programs to allow a user to specify what files to process and the have some control over what to exclude.