javascript - Regex in chrome.declarativeContent.PageStateMatcher -
i need add regex inside chrome.declarativecontent.pagestatematcher.
so far have
var matcher = new chrome.declarativecontent.pagestatematcher({ pageurl: { urlcontains: "something.com/someregex/something" } });
essentially want have regular expression evaluate "something.com/4-5 char string/somithing".
how this? possible chrome.declarativecontent.pagestatematcher?
thanks
instead of urlcontains use urlmatches
this i'm using both domain fedmich.com , fedche.com
chrome.runtime.oninstalled.addlistener(function() { chrome.declarativecontent.onpagechanged.removerules(undefined, function() { chrome.declarativecontent.onpagechanged.addrules([ { conditions: [ new chrome.declarativecontent.pagestatematcher({ pageurl: { urlmatches: '(fedmich|fedche)\.com' }, }) ], actions: [ new chrome.declarativecontent.showpageaction() ] } ]); }); });
documentation here https://developer.chrome.com/extensions/events#property-urlfilter-hostequals
the regular expressions use re2 syntax. https://code.google.com/p/re2/wiki/syntax
Comments
Post a Comment