1.0.0 • Published 5 years ago
wildcard-domain-matcher v1.0.0
node-wildcard-domain-matcher
This module is only for wildcard domain matching and may not work fine with invalid domain name characters or other usage for efficient reason.
class Matcher(opt)
- test(stringdomain,stringpattern,boolleadingWildCardSubdomainOnly=false)
- match(stringdomainarray,patterns,boolleadingWildCardSubdomainOnly=false)
See the examples for usage
examples
var Matcher=require("wildcard-domain-matcher");
var matcher=new Matcher();
//patterns are cached as regexp in the object,if you don't want that use
var matcher=new Matcher({noCache:true);
matcher.test("luojia.me","*.luojia.me");
//true
//leading *. will only match subdomains if leadingWildCardSubdomainOnly=true
matcher.test("luojia.me","*.luojia.me",true);
//false
//return the first pattern matched in the list
matcher.match("luojia.me",["*.luojia.me","luojia.me","*"],true);
//"luojia.me"
1.0.0
5 years ago