Opened 9 months ago

Closed 6 months ago

Last modified 6 months ago

#6034 closed change (fixed)

Add support for regular expressions in :-abp-contains()

Reported by: Lain_13 Assignee: hfiguiere
Priority: P2 Milestone:
Module: Core Keywords: circumvention
Cc: fhd, sebastian, mapx, kzar, hfiguiere, mjethani, sergz Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29613805/

Description

As I understand right now -abp-contains supports only straight text. As the result any variations in it will require a new rule to be added. This makes avoiding filters based on -abp-contains ridiculously simple. Just replace a few characters with similar characters from another language and that's it. Also, site my display a few different patters for ads. Each require separate filter to block.
Regular expressions support in -abp-contains() should fix both issues since it will be possible to write rules like :-abp-contains(/[aа]dv[eе]rt[iі]s[eе]m[eе]nt/) in order to block variations of the same text with foreign characters (notice Russian "а/е" and Ukrainian "і"). Or like this: :-abp-contains(/advertisement|banner/) in order to hide blocks with either 'advertisement' or 'banner' text in them.

BTW, uBlock Origin already supports regular expressions there since they added support for :-abp-contains() as an alias for already existing their own similar feature.

Environment

Adblock Plus development build 3.0.0.1921
Google Chrome 62

How to reproduce

  1. Add filter:

lostfilm-online.ru#?#body > div[style] > div > .block:-abp-has(.block_head:-abp-contains(/Вас\sзаинтересует|Дешевле|Вам\sпонравится|Интересное\sв\sсети/))

  1. Visit lostfilm-online.ru

Observed behaviour

Ads on the left side are visible with ABP, but blocked with uBlock Origin.

Expected behaviour

Ads are blocked with both extensions.

Change History (12)

comment:1 Changed 9 months ago by mapx

The support for regular expressions exists for abp-properties
https://issues.adblockplus.org/ticket/4593

comment:2 Changed 9 months ago by mapx

  • Cc fhd trev sebastian mapx added

comment:3 Changed 9 months ago by mapx

  • Component changed from Unknown to Platform

comment:4 Changed 9 months ago by kzar

  • Cc kzar hfiguiere added

comment:5 Changed 9 months ago by hfiguiere

  • Owner set to hfiguiere

comment:6 Changed 9 months ago by hfiguiere

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:7 Changed 8 months ago by fhd

  • Cc trev removed

comment:8 Changed 7 months ago by kzar

  • Cc mjethani sergz added
  • Component changed from Platform to Core
  • Priority changed from Unknown to P2
  • Ready set

comment:10 Changed 6 months ago by abpbot

A commit referencing this issue has landed:
Issue 6034 - :-abp-contains() accept a regular expression

comment:11 Changed 6 months ago by hfiguiere

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:12 Changed 6 months ago by mjethani

  • Keywords circumvention added
Note: See TracTickets for help on using tickets.