Class RegExpFilter
Extends
ActiveFilter.
Defined in: filterClasses.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
RegExpFilter(text, regexpSource, contentType, matchCase, domains, thirdParty)
Abstract base class for RegExp-based filters
|
| Field Attributes | Field Name and Description |
|---|---|
|
Content types the filter applies to, combination of values from RegExpFilter.typeMap
|
|
|
Number of filters contained, will always be 1 (required to optimize Matcher).
|
|
|
Defines whether the filter should distinguish between lower and upper case letters
|
|
|
Regular expression to be used when testing against this filter
|
|
|
Expression from which a regular expression should be generated - for delayed creation of the regexp property
|
|
|
Defines whether the filter should apply to third-party or first-party content only.
|
|
| <static> |
RegExpFilter.typeMap
Maps type strings like "SCRIPT" or "OBJECT" to bit masks
|
- Fields borrowed from class ActiveFilter:
- disabled, domains, domainSource, hitCount, ignoreTrailingDot, lastHit
- Fields borrowed from class Filter:
- subscriptions, text
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
RegExpFilter.fromText(text)
Creates a RegExp filter from its text representation
|
|
matches(location, contentType, docDomain, thirdParty)
Tests whether the URL matches this filter
|
- Methods borrowed from class ActiveFilter:
- isActiveOnDomain, isActiveOnlyOnDomain, serialize
- Methods borrowed from class Filter:
- toString
Class Detail
RegExpFilter(text, regexpSource, contentType, matchCase, domains, thirdParty)
Abstract base class for RegExp-based filters
- Parameters:
- {String} text
- see Filter()
- {String} regexpSource
- filter part that the regular expression should be build from
- {Number} contentType
- (optional) Content types the filter applies to, combination of values from RegExpFilter.typeMap
- {Boolean} matchCase
- (optional) Defines whether the filter should distinguish between lower and upper case letters
- {String} domains
- (optional) Domains that the filter is restricted to, e.g. "foo.com|bar.com|~baz.com"
- {Boolean} thirdParty
- (optional) Defines whether the filter should apply to third-party or first-party content only
Field Detail
{Number}
contentType
Content types the filter applies to, combination of values from RegExpFilter.typeMap
domainSeparator
- See:
- ActiveFilter.domainSeparator
{Integer}
length
Number of filters contained, will always be 1 (required to optimize Matcher).
{Boolean}
matchCase
Defines whether the filter should distinguish between lower and upper case letters
{RegExp}
regexp
Regular expression to be used when testing against this filter
{String}
regexpSource
Expression from which a regular expression should be generated - for delayed creation of the regexp property
{Boolean}
thirdParty
Defines whether the filter should apply to third-party or first-party content only. Can be null (apply to all content).
<static>
RegExpFilter.typeMap
Maps type strings like "SCRIPT" or "OBJECT" to bit masks
Method Detail
<static>
RegExpFilter.fromText(text)
Creates a RegExp filter from its text representation
- Parameters:
- {String} text
- same as in Filter()
{Boolean}
matches(location, contentType, docDomain, thirdParty)
Tests whether the URL matches this filter
- Parameters:
- {String} location
- URL to be tested
- {String} contentType
- content type identifier of the URL
- {String} docDomain
- domain name of the document that loads the URL
- {Boolean} thirdParty
- should be true if the URL is a third-party request
- Returns:
- {Boolean} true in case of a match