glob.js

v0.1.0
UNIX globbing (wildcard matching) for javascript
glob

Intro

UNIX globbing (wildcard matching) for javascript

Usage

nodejs

var glob= require('./glob').glob;
glob.match('pattern', 'string') // ...

browser

<script src="glob.js"></script>
<script>
  window.glob.match('pattern', 'string') // ...
</script>

Fetures

Match exactly one unknown character

glob.match('ab?d', 'abcd') // ok
glob.match('ab\\?d', 'ab?d') // ok

Match any number of unknown characters

glob.match('ab*d', 'abcaeg@3d') // ok
glob.match('ab\\*d', 'ab*d') // ok

Match a character as part of a group of characters

glob.match('ab[cd]e', 'abce') // ok

Escape character

glob.match('ab\\nc', 'abnc') // ok
glob.match('ab\\mc', 'abmc') // ok

Combining

glob.match("ab?c*[df]\\d|.q", 'ab1c234fd|.q') // ok

Install

bower install glob.js
npm i glob.js

Metadata

  • MIT
  • Whatever
  • ichuan
  • released 11/15/2014

Downloads

Maintainers