adblockparser icon indicating copy to clipboard operation
adblockparser copied to clipboard

problem with rule to regexp

Open rriemann opened this issue 7 years ago • 0 comments

Hello,

Question regarding the line rule = re.sub("(\|)[^$]", r"\|", rule) in https://github.com/scrapinghub/adblockparser/blob/master/adblockparser/parser.py#L272 :

This would not only escape the pipe sign, but also remove the sign following the pipe.

Actual behaviour:

>>> import re
>>> rule = "iue|ie"
>>> re.sub("(\|)[^$]", r"\|", rule)
'iue\\|e'

Expected behaviour: iue\\|ie

rriemann avatar May 17 '18 10:05 rriemann