Skip to content

TylerPachal/wild

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wild

Build Status Hex.pm version

Wild is a wildcard matching library that implements unix-style blob pattern matching functionality for Elixir binaries (without actually interacting with the filesystem itself). It works on all binary input and defaults to working with codepoint representations of binaries, but other modes are also available.

Installation

Add the :wild dependency to your mix.exs file:

def deps do
  [
    {:wild, "~> 1.0.1"}
  ]
end

Example Usage

# Simple match
iex> Wild.match?("foobar", "foo*")
true

# Simple non-match
iex> Wild.match?("foobar", "bar*")
false

# Classes are supported
iex> Wild.match?("foobar", "fo[a-z]bar")
true

# Non-printable binaries can be matched in byte mode
iex> Wild.match?(<<16, 196, 130, 4>>, "????", mode: :byte)
true

# Check validity of pattern
iex> Wild.valid_pattern?("fo[a-z]b?r")
true

About

Wildcard matching in Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published