Build Status

glob

A library application to work with glob patterns. Now also available on hex.pm.

Syntax

This implementation provides the same glob pattern facilities as bash (partly from Wikipedia):

The underlying implementation utilizes the re module which means that a given glob pattern will be converted into a regular expression. For convenience this module features an API that is quite similar to the re module. Although, the shorthand glob:matches/1 enables a more intuitive and simple experience.

As glob relies on re it offers support for Unicode input. However, this support comes with the same restrictions known from re.

Example

Simple matches:

    false = glob:matches("Hello World", "Hello"),
    true = glob:matches("Hello World", "*"),
    true = glob:matches("Hello World", "Hello*Wo?l[d]"),

Match unicode input for expression/pattern and subject:

    {ok, MP} = glob:compile(<<"*ä?ö"/utf8>>, true),
    true = glob:matches("äüö", MP),