View Source Virtfs.PathGlob (virtfs v0.1.4)
Implements glob matching using the same semantics as Path.wildcard/2, but
without any filesystem interaction.
Link to this section Summary
Functions
Returns whether or not path matches the glob.
Link to this section Functions
@spec match?(String.t(), String.t(), [{:match_dot, boolean()}]) :: boolean()
@spec match?(Regex.t(), String.t(), [{:match_dot, boolean()}]) :: boolean()
Returns whether or not path matches the glob.
The glob is first parsed and compiled as a regular expression. If you're
using the same glob multiple times in performance-critical code, consider
using compile/1 and caching the result.
examples
Examples
iex> Virtfs.PathGlob.match?("{lib,test}/path_*.ex", "lib/path_glob.ex")
true
iex> Virtfs.PathGlob.match?("lib/*", "lib/.formatter.exs", match_dot: true)
true