# Rule Syntax

When you create a rule, it is entered in the rules.ima or orules.ima file in the following format:

Single condition rule: message area condition search text quantifier : mailbox_name

Multiple condition rule: message area condition search text quantifier !AND!/ !OR! message area condition search text quantifier: mailbox name

Message Area | Representation
From | F
Subject | S
Sender | N
To | T
Header (everything preceding the body) | H
Body of the message | B

Condition | Expression
Contains | ~
Does not contain | !~
Equals | =
Does not equal | !=

Text Patterns | Expression
Any character | .
Any of the values separated by vertical bars within the parentheses;the vertical bar represents "or" | (this|that|other)
Any word characters (A-Z, a-z, 0-9) | \w
Any non-word character | \W
Any digit (0-9) | \d
Any non-digit | \D
Any non-white space (spaces, tabs, and carriage returns) | \s
Any non-white space | \S
Any punctuation character | \p
Any non-punctuation character | \P

Note that the following characters have special meaning.

Quantifier | Expression
Zero or more | *
One or more | +
Exactly 100 | {100}
At least n1, but not more than n2(wher n1 and n2 are numbers) | {n1,n2}