Filter strings by first cutting out regions (include) and then selectively remove (exclude) from region.
It assumes that if include is empty everything should match.
I often use this in my programs to allow a user to specify what files to process and have some control over what to exclude.
--re-include and --re-exclude is a suggestion for parameters to use with getopt.
The regular expressions are set to ignoring the case.
Example:
auto r = ReFilter(["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 regions (include) and then selectively remove (exclude) from region.
It assumes that if include is empty everything should match.
I often use this in my programs to allow a user to specify what files to process and have some control over what to exclude.
--re-include and --re-exclude is a suggestion for parameters to use with getopt.