<commit_before># ohmyglob

A minimal glob matching utility for Go.

![ohmyglob!](http://i.imgur.com/7vjO2mF.gif)

[![Build Status](https://travis-ci.org/obeattie/ohmyglob.svg?branch=master)](https://travis-ci.org/obeattie/ohmyglob)

Works internally by converting glob expressions into [`Regexp`](http://golang.org/pkg/regexp/#Regexp)s, which are then
used to match strings.

## Features

* Customisable separators
* `*` matches any number of characters, but not the separator
* `?` matches a single character, but not the separator
* `!` at the beginning of a pattern will negate the match
* ["Globstar"](http://www.linuxjournal.com/content/globstar-new-bash-globbing-option) (`**`) matching

## Usage

    import glob "github.com/obeattie/ohmyglob"
    
    var g glob.Glob
    var err error
    var doesMatch bool
    
    // Standard, with a wildcard
    g, err = glob.Compile("foo/*/baz", glob.DefaultOptions)
    doesMatch = g.MatchString("foo/bar/baz") // true!
    doesMatch = g.MatchString("nope") // false!
    
    // Globstar
    g, err = glob.Compile("foo/**/baz", glob.DefaultOptions)
    doesMatch = g.MatchString("foo/bar/bar/baz") // true!
    doesMatch = g.MatchString("foo/baz") // true!
<commit_msg>Mention glob sets in the README<commit_after># ohmyglob

A minimal glob matching utility for Go.

![ohmyglob!](http://i.imgur.com/7vjO2mF.gif)

[![Build Status](https://travis-ci.org/obeattie/ohmyglob.svg?branch=master)](https://travis-ci.org/obeattie/ohmyglob)

Works internally by converting glob expressions into [`Regexp`](http://golang.org/pkg/regexp/#Regexp)s, which are then
used to match strings.

## Features

* Customisable separators
* `*` matches any number of characters, but not the separator
* `?` matches a single character, but not the separator
* `!` at the beginning of a pattern will negate the match
* ["Globstar"](http://www.linuxjournal.com/content/globstar-new-bash-globbing-option) (`**`) matching
* Glob sets allow matching against a set of ordered globs, with precedence to later matches

## Usage

    import glob "github.com/obeattie/ohmyglob"
    
    var g glob.Glob
    var err error
    var doesMatch bool
    
    // Standard, with a wildcard
    g, err = glob.Compile("foo/*/baz", glob.DefaultOptions)
    doesMatch = g.MatchString("foo/bar/baz") // true!
    doesMatch = g.MatchString("nope") // false!
    
    // Globstar
    g, err = glob.Compile("foo/**/baz", glob.DefaultOptions)
    doesMatch = g.MatchString("foo/bar/bar/baz") // true!
    doesMatch = g.MatchString("foo/baz") // true!

{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0015698587127158557, 'mean_word_length': 3.6684981684981683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4275293', 'n_tokens_mistral': 869, 'n_tokens_neox': 833, 'n_words': 214}