uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

Regular expression does not work in the filter of logger since 0.9.7.0

Open g3939434 opened this issue 11 years ago • 2 comments

Since the version of 0.9.7.0, which had been imported the Unified logger from uMatrix. Regular expression does not work in the filter of logger anymore.

Quote from wiki - network request logger

The filter expression can be a plain regular expression:

  • /image|css/: show all requests which type is image or css
  • !/image|css/: show all requests which type is not image neither css

g3939434 avatar May 22 '15 18:05 g3939434

The new expression parser is different, it's more flexible overall, whereas I chose to support regex with the old parser because of its inherent limitations.

The first case can't be replicated with the new parser however.

The second case can be replicated using simply !image !css.

For the first case, if really needed, I may choose to support a custom syntax which less advanced user can use, maybe ~~||~~ OR to or expressions together (default is to and them).

gorhill avatar May 22 '15 18:05 gorhill

The filter expression parser now supports || to be used to or together subexpressions (in the end I chose || because this is language-neutral). Regular expressions are still not supported, as the end goal is not to support regexes, but to support a syntax which allows to support or'ing expressions together.

So equivalent for /image|css/ is now image || css, and !/image|css/ is now !image || css (the not (!) applies to the result of the or'ing the subexpressions), or equivalent !image !css.

gorhill avatar May 23 '15 13:05 gorhill