<script src="https://jc3213.github.io/matchpattern.js/matchpattern.js"></script>
// @require https://jc3213.github.io/matchpattern.js/matchpattern.js
let pattern = MatchPattern.create("www.example.com"); // *.example.com
- pattern
string
- url
string
https://www.example.com/pathname
www.example.com
*.example.com
*.example.com
- Matches
www.example.com
,example.com
- Doesn't Match
test-example.com
,www.example.com.cn
- Matches
example.*
- Matches
example.com
,example.co.uk
- Doesen't Match
www.example.com
,example-test.com
- Matches
Match Pattern | Target Hostname |
---|---|
<all-urls> | All hostnames |
www.university.org.eu *.university.org.eu *.org.eu |
www.university.org.eu |
doc.university.org.eu doc.university.org.* doc.university.* |
doc.university.org.eu |
192.168.1.* 192.168.* 192.* |
192.168.1.1 |
let { regexp, string } = MatchPattern.generate( [ patternA, patternB, ..., patternZ ] );
- regexp
Regular Expression
/^(patternA|patternB|...|patternZ)$/i
- string
string
^(patternA|patternB|...|patternZ)$
- pattern
string
*.some.host
192.168.*
- Don't support ipv6 though