Bug 207539 - Add unsupported regular expressions in Content Blocker url-filter
Summary: Add unsupported regular expressions in Content Blocker url-filter
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Other
Hardware: All Unspecified
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-11 06:31 PST by Kyle Hickinson
Modified: 2020-02-19 02:09 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Hickinson 2020-02-11 06:31:00 PST
The Content Blocker url-filter string is very limiting in terms of available regex syntax. As seen here: https://developer.apple.com/documentation/safariservices/creating_a_content_blocker, it specifies that `url-filter` can be used to match more than just a specific URL, using regular expressions. However the then listed supported characters is only a very limited subset of regular expressions. The API should allow use of all or most of the regex language as seen here: https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference

At Brave we use a combination of blocklists and many rules include basic regex such as logical or's. This makes it very difficult to convert rules written for AdBlock Plus or uBlock Origin without changing the underlying rule or splitting them into multiple rules.

rdar://FB7557881
Comment 1 Radar WebKit Bug Importer 2020-02-11 09:26:51 PST
<rdar://problem/59350912>
Comment 2 Maciej Stachowiak 2020-02-19 02:09:20 PST
Which regex operators do you need? Is it specifically `|` or are there others? I'm not sure we would want to support everything in .NET regexes or even everything in JavaScript regexes here, for the sake of speed of the matcher.

Specific examples of rules that don't translate directly would be helpful.