[feature] Support multiline regex in text filtering
Opened this issue · 4 comments
It seems that Trigger/wait for text
, Ignore lines containing
, Block change-detection while text matches
in Text filtering
section do not support multiline regex.
Narrowed it down to:
changedetection.io/changedetectionio/html_tools.py
Lines 365 to 403 in 5dea5e1
The function iterates over the content line by line and matches each regex to each line:
for line in content.splitlines(keepends=True):
The function could be reworked to use re.finditer
/re.findall
on the whole content instead.
it COULD be reworked, but then it would maybe break all existing filters, whats your thoughts on how to handle that?
Unless I'm missing something it would only break regex filters that have s
or m
flags set (currently those flags have no effect) or regex that captures \n
in the middle of the pattern (currently such regex matches nothing). Everything else should behave the same.
Other option is to match on the whole content only when the s
or m
flag is set, otherwise use the current implementation.
Other option is to match on the whole content only when the s or m flag is set, otherwise use the current implementation.
yes! what i'm thinking.. any downsides?
Downsides are that you have to supports two versions of text filtering, and that filters that already set s
or m
flags could break.