Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#4593 closed change (fixed)

Support regular expressions for CSS property matching

Reported by: fhd Assignee: fhd
Priority: P2 Milestone:
Module: Core Keywords:
Cc: trev, kzar Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29361640/

Description

Background

CSS property matching is not particularly flexible. The syntax is the same as for URL filter expressions, which only supports the * wild card. Supporting regular expressions for property matching would make CSS property filters a lot more powerful.

What to change

Interpret the value of -abp-properties as a regular expression if it begins and ends with / (minus those characters). If the value doesn't begin and end with /, it should be interpreted as a filter matching expression, same as now.

Examples:

  • example.com##[-abp-properties="margin: 5px"] should match margin: 5px verbatim.
  • example.com##[-abp-properties="margin: *"] should match anything containing the string margin: .
  • example.com##[-abp-properties="/margin: [0-9]px"] should match /margin: [0-9]px verbatim.
  • example.com##[-abp-properties="margin: [0-9]px/"] should match margin: [0-9]px/ verbatim.
  • example.com##[-abp-properties="/margin: [0-9]px/"] should use the regular expression margin: [0-9]px for matching.

Change History (6)

comment:1 Changed 2 years ago by fhd

  • Cc kzar added

comment:2 Changed 2 years ago by fhd

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

comment:3 Changed 2 years ago by fhd

  • Blocking 4600 added

comment:4 Changed 2 years ago by abpbot

A commit referencing this issue has landed:
Issue 4593 - Support regular expressions for CSS property matching

comment:5 Changed 2 years ago by fhd

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

comment:6 Changed 2 years ago by trev

  • Blocking 4600 removed
Note: See TracTickets for help on using tickets.