-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve extraction of tokens from regex-based filters
Regex-based static network filters are those most likely to cause performance degradation, and as such the best guard against undue performance degradation caused by regex-based filters is the ability to extract valid and good tokens from regex patterns. This commit introduces a complete regex parser so that the static network filtering engine can now safely extract tokens regardless of the complexity of the regex pattern. The regex parser is a library imported from: https://github.com/foo123/RegexAnalyzer The syntax highlighter adds an underline to regex-based filters as a visual aid to filter authors so as to avoid mistakenly creating regex-based filters. This commit further colors the underline as a warning when a regex-based filter is found to be untokenizable. Filter list authors are invited to spot these untokenizable regex-based filters in their lists to verify that no mistake were made for those filters, causing them to be untokenizabke. For example, what appears to be a mistake: /^https?:\/\/.*\/sw.js?.[a-zA-Z0-9%]{50,}/ Though the mistake is minor, the regex-based filter above is untokenizable as a result, and become tokenizable when the `.` is properly escaped: /^https?:\/\/.*\/sw\.js?.[a-zA-Z0-9%]{50,}/ Filter list authors can use this search expression in the asset viewer to find instances of regex-based filters: /^(@@)?\/[^\n]+\/(\$|$)/
- Loading branch information
Showing
9 changed files
with
2,300 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
https://github.com/foo123/RegexAnalyzer/issues/1#issuecomment-750039255 | ||
|
||
> The (implied) license is as free as it can get. You can modify it and use | ||
> it anywhere you want if it suits you. | ||
> | ||
> An attribution to original author would be appreciated but even this is not | ||
> mandatory. | ||
> | ||
> Copy Left | ||
References: | ||
|
||
- https://en.wikipedia.org/wiki/Copyleft | ||
- http://gplv3.fsf.org/wiki/index.php/Compatible_licenses |
Oops, something went wrong.