1.2.0 • Published 9 years ago

wild v1.2.0

Weekly downloads
4
License
ISC
Repository
-
Last release
9 years ago

wild

Build status NPM version Downloads Dependency Status

Generate regexp by wildcard string

Installation

npm i wild

Api

wild(str[, isStrict]) => return regexp

if isStrict is true, wild will return regexp like /^ ... $/

Usage

wild only cares about the wildcard *, and escape other special chars in regexp

var wild = require('wild')

var reg = wild('http://google.com/*', true)
// => /^http:\/\/google\.com\/.*$/

reg.test('http://google.com/foo')
// => true

Advanced

get source by wild.source

wild.source('http://google.com/*')
// => 'http://google\\.com/.*'

// different with raw source

wild('http://google.com/*').source
// => 'http:\/\/google\.com\/.*'

License

License

1.2.0

9 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago