proginosko / LeechBlockNG-chrome

LeechBlock NG (Next Generation) for Chrome is a simple productivity tool designed to block those time-wasting sites that can suck the life out of your working day. All you need to do is specify which sites to block and when to block them.
https://www.proginosko.com/leechblock/
Mozilla Public License 2.0
73 stars 14 forks source link

Regex Bug #15

Closed ghost closed 3 years ago

ghost commented 4 years ago

Hello everyone, I use LeechBlock and block sites with Regex. My problem is if I block the word with a questionmark for example q=hotel? it also blocks hope, hopsen etc. But I just want to block this exact word. It looks like it just read the first two letters and the rest it completely ignore and block everything what at least in slightest looks like that. There should be done something. Something in the Regex function doesn't work correct. Hope you find it and thanks for your great work and your useful extension. With kind regards, Lukas

proginosko commented 4 years ago

Put a backslash (\) before the question mark. In general, special characters in regular expressions will be treated as regular characters when prefixed with a backslash: \? \* \+ \. etc.

ghost commented 4 years ago

You missunderstood me I want the question mark as Regex Character. I don't want to mask it to search for a question mark

ghost commented 4 years ago

The Problem is that the "?" don't do what it should. A Regex "?" search for the whole word before it and not just two characters. This is the problem

proginosko commented 4 years ago

In a regex, the ? makes the preceding token optional. So hotel? should match "hote" and "hotel". Since your regex is open-ended, it should also match anything with "hote" or "hotel" followed by any number of other characters. It should not match "hope" or "hopsen".

Please export your settings to a text file (Options > General > Export Options to File) and email it to leechblockng@proginosko.com so I can take a closer look.

proginosko commented 4 years ago

I said email the text file to me, not post the content here!