npm.io
0.1.0 • Published 11 years ago

glob.js

Licence
MIT
Version
0.1.0
Deps
0
Vulns
0
Weekly
0

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

Keywords