-
Notifications
You must be signed in to change notification settings - Fork 83
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.
This comment was marked as abuse.
This comment was marked as abuse.
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 abuse.
This comment was marked as abuse.
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:
|
This comment was marked as abuse.
This comment was marked as abuse.
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, |
This comment was marked as abuse.
This comment was marked as abuse.
The ultimate revision is the one based on a regex analyzer, introduced in gorhill/uBlock@426395a. |
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: