akrennmair / newsbeuter

Newsbeuter is an open-source RSS/Atom feed reader for text terminals.
http://www.newsbeuter.org/
MIT License
780 stars 97 forks source link

Better syntax for filterexprs in config #298

Open Minoru opened 8 years ago

Minoru commented 8 years ago

At the moment, filterexprs have to be enclosed in quotes which are themselves escaped as they're within another set of quotes, like this:

ignore-article "*" "title =~ \"Windows\""

Ugh.

But we can fix this without even breaking anything (in theory, at least). Simply make the first non-whitespace character that follows the operator to be a delimiter! Then we'll be able to write things in a more usual regexp-ish style:

ignore-article "*" "title =~ /Windows/"

Of course, we should be able to escape the delimiter for it to be interpreted literally:

ignore-article "*" "title =~ /Windows\/Unix\/Mac/"

(apart from the obvious option of choosing a more appropriate delimiter.)

Minoru commented 8 years ago

Even though the main incentive for this change is to make configs prettier, things don't stop there. This is actually a change to the filter expressions parser itself, so the change will be available from the dialogs within Newsbeuter UI as well.