Closed heull001 closed 2 years ago
Better filters are definitely something we want and we are tracking it at https://github.com/fossar/selfoss/issues/1125. So far, it is stuck on coming up with a suitable user interface.
If you just want to filter out a a prefix, the PCRE is actually quite simple: ^(?!\[Ad\] ).*foo.*
php > var_dump(array_map(fn($str) => preg_match('(^(?!\[Ad\] ).*foo.*)', $str), ['[Ad] buy our foos', 'review of best foo', '[Ad] free bar when shopping', 'Bar wins award']));
array(4) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(0)
[3]=>
int(0)
}
But yeah, it should be even simpler.
The most annoying part is not being able to see what does the filter remove, I want to add a source preview for that.
I can help you with the regular expressions until https://github.com/fossar/selfoss/issues/1125 is implemented. Closing this as a duplicate.
Great, thx. I am not very familiar with PCRE. I tried many expressions, /(?!^[Ad])/ and /.*(?![Ad])/ for example, it works fine now.
I would like to have the ability to negate the filter-expression. One of my feeds includes advertisements sometimes. The titles of those are beginning with a specific word, so it would be easy to filter them, but writing a pcre which is true, only when a word is NOT included is very complecated. So it would be helpfull to negate the filter and show only items where preg_match($filter, $title) is false.