Opened 3 years ago

Closed 3 years ago

Last modified 3 years 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):


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.


Adblock Plus development build
Google Chrome 62

How to reproduce

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

  1. Visit

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 3 years ago by mapx

The support for regular expressions exists for abp-properties

comment:2 Changed 3 years ago by mapx

  • Cc fhd trev sebastian mapx added

comment:3 Changed 3 years ago by mapx

  • Component changed from Unknown to Platform

comment:4 Changed 3 years ago by kzar

  • Cc kzar hfiguiere added

comment:5 Changed 3 years ago by hfiguiere

  • Owner set to hfiguiere

comment:6 Changed 3 years ago by hfiguiere

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

comment:7 Changed 3 years ago by fhd

  • Cc trev removed

comment:8 Changed 3 years ago by kzar

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

comment:9 Changed 3 years ago by mapx

While on it did you consider the Regular expression flags too ?


Version 0, edited 3 years ago by mapx (next)

comment:10 Changed 3 years ago by abpbot

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

comment:11 Changed 3 years ago by hfiguiere

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

comment:12 Changed 3 years ago by mjethani

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