2.2.13.3.1.3 LIKE Predicate

The LIKE predicate MUST be true if the specified pattern matches in the property, and the property is a retrievable property. Otherwise, the predicate MUST be false. The basic syntax is as follows:

 …property LIKE pattern…

The pattern is a normal string, as defined in section 2.2.13.1. It MUST be interpreted as any other string, with the following exceptions:

The "%" character MUST match zero or more of any other character.

The "_" character MUST match any single character.

Characters enclosed by square brackets (for example "[abc]") MUST match a single occurrence of either of the characters within the square brackets.  This matching MUST be case-insensitive.  The square brackets can contain a range in the form "[a-z]".  The result of this syntax MUST match one of any character in the range.  If the first character in the square brackets is a caret ("^"), the matching MUST reverse, that is, any character that would have matched without the caret MUST NOT match, and vice versa.

To specify a literal percent sign, the protocol client MUST enclose it in square brackets.

For example, the following predicate syntax example:

 …title LIKE ‘com%’…

 matches all items whose title starts with the letters "com".

The following predicate syntax example:

 title LIKE ‘co[m-p]%’

matches items whose title starts with "com", "con", "coo" or "cop".

 like-predicate                =   identifier 1*ws "LIKE" 1*ws like-wildcard-literal
 like-wildcard-literal         =   string