-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix regex for uBO (addresses https://github.com/DandelionSprout/adfil… #134630
Conversation
Our regexes are valid. The most of filters have rules with |
Then how about
Yeah, found on Annoyances as well and I won't fix them all. Not too serious issue. |
I think that this issue can also occur in the case of many filter lists, since |
So move to https://github.com/AdguardTeam/FiltersCompiler ? |
I think this issue is related to the uBlock parser: I guess uBO also uses lists that don't go through the AG's Filters Compiler, and those lists can easily use |
By the way, here is the problematic part in the analyzer library: When line 1094 checks whether the currently iterated character is a hyphen, you need a lookahead in which you check whether the next character sequence is whitespaces + closing bracket. But this seems like a rather outdated / low documented / low tested library, I think there are much more modern ones. |
Without any warranty, something like this: https://github.com/scripthunter7/RegexAnalyzer/blob/master/src/js/Regex.js |
We discussed this a long time ago, I said I would fix this eventually, we should not bother AdGuard's repo just because I take long to fix stuff which is one thing among all the rest I need to work on. |
Fixed flawed extraction of tokens with optional sequences, i.e. when quantifier could be zero. Related issue: - uBlockOrigin/uBlock-issues#2367 Ignore look-around sequences as suggested when normalizing into tokenizable string. Related issue: - uBlockOrigin/uBlock-issues#2368 Fix regex analyzer throwing with trailing `-` in character class sequence. Related issue: - AdguardTeam/AdguardFilters#134630
@gorhill About the commit (I cannot leave a comment in the commit page, seems to be an issue of GitHub?): I wonder if modifying the regex.js library without populating to the upstream is a good idea. Also this doesn't seem to deal with the I would recommend preprocessing regex strings by escaping starting and ending |
That is limitation to disable open issues in repository of add-on code. Sometimes someone can turn it off - once I managed to give a reaction to PR and after a few days someone blocked it (undo/new actions was down). |
…t/discussions/163#discussioncomment-4117315)
Creating the pull request
Prerequisites
To avoid invalid pull requests, please check and confirm following terms
What problem does the pull request fix?
If the problem does not fall under any category that is listed here, please write a comment below in corresponding section
What issue is being fixed?
Enter the issue address
DandelionSprout/adfilt#163 (reply in thread)
It turned out uBO requires
-
to be escaped if it's at the end.Terms