to-regexp
v0.1.7
Published
Convert globs, strings, and arrays to a single RegExp.
Downloads
38
Keywords
Readme
to-regexp
Turns wild card-style glob ('foo*'
) and stringified regular expressions ('/foo.*/'
) into RegExp objects.
Install
npm install to-regexp
Usage
var toRegExp = require('to-regexp');
var re = toRegExp('foo*');
re.test('foo'); // true
re.test('foobar'); // true
var re = toRegExp('/foo.*/');
re.test('foo'); // true
re.test('foobar'); // true