Ublock: static syntax inconsistency

Created on 25 Aug 2017  路  5Comments  路  Source: gorhill/uBlock

using 1.13.8 with Fanboy Ultimate on Pale Moon 27.4

This rule works on this IMDb page:
/wrap$image,domain=imdb.com

But this rule does _not_ work on this TVguide page:
/thumb$image,important,domain=tvguide.com
Instead, I had to expand it. Now this works:
||tvgcdn.net^*/thumb$image,important,domain=tvguide.com

(Note that $important needed to override an EasyList allow for tvguide.com. It's still the same problem without it.)

This appears to be a bug of syntax parsing inconsistency.

not a bug

All 5 comments

I don't see "wrap" on IMDB page, but on TVguide "/thumb" is realy "/thumbs" and uBlock assumes word boundary for this type of filters. Use "/thumb*" or "/thumbs".

https://github.com/gorhill/uBlock/issues/1065

By design as pointed out by @gwarser. Use asterisk if you want /thumb to match /thumbs. Best is of course to use /thumbs/* because the no regex will be used internally, just plain string comparison.

(I also don't see any instances of /wrap on IMDB).

/wrap is there in the link I provided:

untitled

Okay, so it's a matter of word boundary and need for *. That's what I needed to know. (BTW, /thumb* is useful for at least 2 different patterns on various pages of tvguide.com which is why I did it that way.)

And let me echo what lewisje requested in #1065 - _please add important details like this to the wiki page_. (Likewise, please do the same for the my comment last week for the Logger wiki page.)

Best is of course to use /thumbs/* because the no regex will be used internally, just plain string comparison.

Does /foo/$domain=bar ensure plain string comparison?

This would mean for my 2 rules in this thread:

  1. /thumb/ instead of /thumb* to match "thumbs" and "thumbnail"

  2. /wrap/ instead of /wrap for screenshot in my prior post

Thankfully I've now learned enough that I can answer my own question -- No, /foo/ results in a regular expression. (I got the idea a little while ago to view the sqlite contents to see the compiled values.)

The * at the end makes a big difference, resulting in a plain string comparison, as gorhill mentioned. Thus /foo/* is the way to go. This makes sense, since there are a bunch of rules like that in EasyList already.

So I've come full circle with my 2 rules being what I posted originally. (Minor change is adding a dash for /wrap- to be a bit more honed in.) I could use /thumb*... for tvguide but kept the tvgcdn-prefixed one because they're all hosted there (which is what the logger rule wizard would suggest as well).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Phlipout picture Phlipout  路  3Comments

KonoromiHimaries picture KonoromiHimaries  路  3Comments

UnicornVariant picture UnicornVariant  路  3Comments

GSNord picture GSNord  路  3Comments

splattadat picture splattadat  路  4Comments