Skip to content

A Javascript library that manages mach patterns for matching urls

License

Notifications You must be signed in to change notification settings

jc3213/matchpattern.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Usage

Download

Latest

HTML

<script src="https://jc3213.github.io/matchpattern.js/matchpattern.js"></script>

TamperMonkey

// @require https://jc3213.github.io/matchpattern.js/matchpattern.js

Syntax

let matchPattern = new MatchPattern();

Method

add

matchPattern.add('*.google.com');
  • add *.google.com to match patterns

remove

matchPattern.remove('*.github.com');
  • remove *.github.com from match patterns
  • if *.github.com is not in match patterns, do nothing

match

matchPattern.match('https://www.bing.com/'); // false
  • match https://www.bing.com/ with match patterns
  • returns false, if not match pattern is added

Match Pattern

Target Hostname Valid Match Pattern
www.university.org.eu www.university.org.eu
*.university.org.eu
*.org.eu
doc.university.org.eu doc.university.org.eu
doc.university.*
doc.university*
user.university.org.eu *.user.university.org.eu
*.university.org.eu
*university.org.eu