Support regex rules with an end-anchor (`$`)
Consider the following filter:
/^https?:\/\/[a-z]{8,15}\.top\/[a-z]{4,}\.json$/$xhr,3p,match-case
There are two $ characters in the filter. The first represents an anchor to the end of a URL, and the second separates the pattern part of the filter from the options.
adblock-rust currently treats the first $ character as the separator, such that the pattern no longer ends with a / character. match-case is only supported for regex rules, so the rule is ultimately considered invalid.
AdGuard support match-case for all network filters: https://adguard.com/kb/ko/general/ad-filtering/create-own-filters/#match-case-modifier
Same Adblock Plus: https://testpages.adblockplus.org/en/filters/match-case
Only uBo don't see reason to implement wider than regex (where someone intentionally used [A-Z] instead [a-z] that can match capital letters in network filtering normaly).
Hello @antonok-edm, How can I regenerate this issue and Test it once I apply the solution?
@harshdevl if you'd like to give this a try you can check the network filter parsing code. You could test this by writing some parsing unit tests similar to the ones starting here.
If you've successfully parsed the above filter, the filter field should include the first $ character.
to keep it simple, and based on what I have understood so far. I was planning to make this regex change here.
I'd strongly recommend unit testing at the network filter level; the Engine tests may be too high-level to confirm that the parsing is correct.
Got it. Thanks.