The Mutt E-Mail Client : Advanced Usage : Patterns : Complex Patterns
Previous: Pattern Modifier
Next: Searching by Date

## 4.2.2. Complex Patterns

Logical AND is performed by specifying more than one criterion. For example:

> `

>     ~t mutt ~f elkins

> `

would select messages which contain the word ``mutt'' in the list of recipients and that have the word ``elkins'' in the ``From'' header field.

Mutt also recognizes the following operators to create more complex search patterns:

- ! -- logical NOT operator
- | -- logical OR operator
- () -- logical grouping operator

Here is an example illustrating a complex search pattern. This pattern will select all messages which do not contain ``mutt'' in the ``To'' or ``Cc'' field and which are from ``elkins''.

> `

>     !(~t mutt|~c mutt) ~f elkins

> `

Here is an example using white space in the regular expression (note the ' and " delimiters). For this to match, the mail's subject must match the ``ˆJunk +From +Me$'' and it must be from either ``Jim +Somebody'' or ``Ed +SomeoneElse'':

> `

>      '~s "^Junk +From +Me$" ~f ("Jim +Somebody"|"Ed +SomeoneElse")'

> `

The Mutt E-Mail Client : Advanced Usage : Patterns : Complex Patterns
Previous: Pattern Modifier
Next: Searching by Date