2.2.12.3.1.3 LIKE Predicate

The LIKE predicate MUST be true if the specified pattern matches in the property. The basic syntax is as follows:

 …property LIKE pattern…

The pattern is a normal string, as defined in section 2.2.12.1. It MUST be interpreted like 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-sensitive. The square brackets can contain a range in the form "[a-z]".  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 the title of which starts with the letters "Com".

The following predicate syntax example:

 title LIKE ‘Co[m-p]%’

matches items the title of which starts with "Com", "Con", "Coo" or "Cop".

It is possible that implementation details prevent the protocol server from performing this matching on a given property. In that case, this predicate MUST evaluate to false.

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