wild

1.2.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i wild

Weekly Downloads

4

Version

1.2.0

License

ISC

Last publish

Collaborators

  • ftft1885