Skip to content

Instantly share code, notes, and snippets.

@johnbartholomew
Last active January 1, 2016 00:38
Show Gist options
  • Save johnbartholomew/8067454 to your computer and use it in GitHub Desktop.
Save johnbartholomew/8067454 to your computer and use it in GitHub Desktop.

I'm not trying to precisely match the behaviour of an existing glob syntax unless that behaviour really seems like the most obvious/easiest-to-use syntax. However, I do want globs to feel familiar to use.

I'll say that '**' matches anything, and '*' matches anything except directory separators. Without thinking too hard, how do you expect the following globs to behave?

  1. *.c
  2. **.c
  3. **/*.c
  4. src/*/*.c
  5. src/**

More specifically:

  1. Should '*.c' match '.c'?
  2. Should '**.c' match '.c'?
  3. Should '**/*.c' match 'foo.c'? Should it match 'foo/.c'?
  4. Should 'src/*/*.c' match 'src/foo.c'?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment