-
Notifications
You must be signed in to change notification settings - Fork 80
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
[x-]
is not correctly handled
#2374
Comments
Maybe this is why regex was reported as invalid when |
@gwarser Where is it reported? ECMAscript spec seems to allow such use case. |
@gwarser I have read the thread but I don't think there is a consensus that trailing |
I mean, it's this library limitation. |
Related issue: - uBlockOrigin/uBlock-issues#2374
Any more of these cases with regex tokenizer, please add here instead of opening new issue. |
The developer of Regex.js is fixing the issues and it seems that this issue is mostly resolved by the latest release (with a bug that may happen in a very rare case). Maybe we can simply wait for a while for his working. |
Issues in foo123/RegexAnalyzer#5 seems resolved in 1.2.0 |
Related issue: - uBlockOrigin/uBlock-issues#2374
Version of 1.2.0 was imported. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Why, since it matches 3 characters literally, like any others: A note: the whole discussion is regarding a fact that a single char filters in uBO are invalid (orange): for example: |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Syntax highlighting is confusing:
|
I see your point, but also one detail by the way: these are warnings, not errors, and such filters still work, just like in browser dev console there are warnings and errors.
SPOILER (REPLY)
You've just quoted my statement and still didn't explain what is bad/wrong in it, hence I am unable to determine what the hell is your problem.
What is ironic is that I called him like that because he was aggressive towards me for no reason, just like you, and he throwed towards me "is everything okay at home, buddy?" which wasn't nice and is considered calling names as well, hence he deserved to be called accordingly as well. I wonder how did you miss that, and how did you cherry-pick only my statement, maybe because you're blind, but I think that rather you're just purposely trolling, you run out of arguments pretty fast, go troll elsewhere, and don't turn facts upside down. |
Orange is not an error, it just means no token can be extracted from the regex, and as such the filter will be less efficient. A token can be extracted from the first one, |
Also helpful threads related to uBO regex tokenization:
Some similiar examples from old version of uBO tokenizer: Revision A: gorhill/uBlock#2781 (comment):
Revision B: gorhill/uBlock#2781 (comment):
|
The ultimate revision is the one based on a regex analyzer, introduced in gorhill/uBlock@426395a. |
Like on the 3rd screenshoot from #2374 (comment) - there is a message (tool tip) displayed when an error is highlighted, but not when a warning is highlighted. I don't know whether it's an inconsistency or intentionally by design. Besides, another related thread (in case u didn't see): |
Prerequisites
I tried to reproduce the issue when...
Description
The revised regex analyzer does not correctly handle
[x-]
, which is treated as[\-]
and thusx
is not calculated during token extraction.I have raised an issue to the library developer: foo123/RegexAnalyzer#5. Before the library is fixed, we can preprocess the regex string to escape problem-making "-"s in a character group before sending it to the analyzer:
This is somehow ugly and imperformant, but it may be the only way if we're not going to implement a full fix of the library.
Also note that this does not fix the bug in 5th case yet. Fortunately the case should not exist in a real-world URL filter.
A specific URL where the issue occurs.
https://example.com/xfoo
Steps to Reproduce
/^https?://(?:example\.com|ex\.com)/[x-]foo\b/$doc
Expected behavior
The page should be blocked.
Actual behavior
The page is not blocked.
uBO version
1.45.3b4
Browser name and version
Independant
Operating System and version
Independant
The text was updated successfully, but these errors were encountered: