-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Replacing regex pattern tokens breaks semantics #85
Comments
To correct this:
OR
|
@penge What do you think? |
As it wasn't designed for full regular expressions, this change isn't a breaking change and doesn't require an apology. Supporting
Yes, this would be a great addition. How do you think we could implement it? Perhaps as lines formatted like regular expression literals?
|
I meant IF you removed the Regex literals as input is a great idea, but remember to add a regex mode toggle which defaults to false. 🙂 |
Got it. That'd be the case, then.
How about we keep Example:
Would turn into: const regex = new RegExp(String.raw`.*/watch\?v=.*`, "i"); And that would: regex.test("https://www.youtube.com/watch?v=123"); // true
regex.test("https://www.youtube.com/WATCH?v=123"); // true |
@penge 👌 |
block-site/src/helpers/find-rule.ts Lines 19 to 43 in 00d340a
block-site/src/helpers/make-rules.ts Lines 10 to 23 in 00d340a
If a regex to block starts with Maybe a custom flag such as |
I agree. Basically, two approaches there would be: A) user-friendly, some modification,
We could use the semantics we already use, that would be putting
|
This feature will certainly make this application very powerful. |
I'm thinking if a rule tester should go out with this feature, regex is sometimes quite tricky to get right. |
True. Let's have a tester then, to ensure it works as expected before visiting the site(s). Could be an input that accepts one or more URL(s) and it lists the rules that match them (if any; one URL can be matched by more than one rule; excluded from blocking should be also possible to test this way). |
I was thinking something simple like this RED = will block |
I considered this. It can be confusing a bit because "RED" also means "doesn't work", and "GREEN" means "works." What about excluded rules? The color meanings there would be opposite, "GREEN" as "allows", or "RED" as "does not apply." Maybe the colors meaning could be more broader: Note: It may be difficult to work around the new inputs and align them. The large input area may need to be split into separate lines. |
This is confusing for me because: |
or, wherever icons or colors come short, just use TEXT 😄 "blocks" |
block-site/src/helpers/find-rule.ts
Line 25 in 00d340a
replace
here means I cannot use regex meta sequence.
- for example.{3,}
block-site/src/helpers/find-rule.ts
Line 29 in 00d340a
replace
here means I cannot use regex quantifier?
- for exampley?
block-site/src/helpers/find-rule.ts
Line 30 in 00d340a
replace
here means I cannot use*
with any token other than.
- for exampley*
The text was updated successfully, but these errors were encountered: