Module Glob


module Glob: sig  end
Wildcard matching


This module implements shell-like wildcard matching. The wildcards it understands:

These are pretty close to what POSIX wants. It doesn't have named character classes ([[:alpha:]]). I'm still trying to decide if they're worth the bother.

For anything more complicated, you'll need full regular expressions. I like PCRE, myself.

type t 
The type of compiled patterns.
val compile : ?cs:bool -> string -> t
Compile a pattern for matching.

cs : True if the pattern is case-senstive, false for a case-insensitive pattern. Defaults to case-sensitive.
val exec : t -> string -> bool
Match a compiled pattern against a string
val quick : ?cs:bool -> string -> string -> bool
quick pattern against does a one-shot match

cs : True if the pattern is case-senstive, false for a case-insensitive pattern. Defaults to case-sensitive.
val case_sensitive : t -> bool
Returns the case-sensisitiveness of a pattern.
val escape : string -> string
Returns the string with any special wildcard characters escaped.
type re_style = [ `PCRE | `Str ] 
The known types of regular expression syntax for Glob.regexp_of_glob
val regexp_of_glob : ?style:re_style -> ?glob:t -> ?pat:string -> unit -> string
Returns a regular expression version of the glob. The regular expressions aren't neccessarily human-readable.
Raises Invalid_arg if glob and pat are both missing.

style : The type of regular expression syntax to support. The default is 'PCRE.
glob : A compiled wildcard pattern to use. Either this or pat must be given.
pat : A string wildcard pattern to use. Either this or glob must be given.