Skip to content
UNIX globbing (wildcard matching) for javascript
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE
README.md
bower.json
glob.js
glob.min.js
index.js
package.json
test.js

README.md

Intro

UNIX globbing (wildcard matching) for javascript

Usage

nodejs

$ npm install glob.js
var glob= require('glob.js');
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
Something went wrong with that request. Please try again.