0.1.0 • Published 9 years ago

glob.js v0.1.0

Weekly downloads
271
License
MIT
Repository
github
Last release
9 years ago

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