Boolean filter conditions for rules

How can I specify a filter condition in a rule that requires both of two words to appear in the subject line: subject line includes “foo” AND “bar” (they may not appear next to each other?

Ideally I would like to be able to specify more complex conditions:

subject line includes (“foo” AND “bar”) OR “foobar”
or
subject line includes “foo” AND (“bar” OR “mar”)
and so forth.

But I could work with a simple option for “require ALL of the specified words to appear in the subject line” on the filter condition.

It can’t be done in Rules as you can only have one occurrence of each field. In that field, it is an OR condition.

So you can have subject line to include “bar” or “mar” or “foo” etc.