6.6.5.1 jcr:like Function

This function is based on the LIKE predicate found in SQL. Support for this function is required, as described in 6.6.3.3 Property Constraint.

jcr:like($property as attribute(),
$pattern as xs:string
) as xs:boolean

For example, the query “Find all paras in document whose title property includes the substring ‘Java’ ”, is expressed as:

/jcr:root/document/para[jcr:like(@title,'%Java%')]

As in SQL, the character ‘%’ represents any string of zero or more characters, and the character ‘_’ (underscore) represents any single character. Any literal use of these two characters must be escaped with a backslash (“\”). Consequently, any literal instance of a backslash must also be escaped, resulting in a double backslash (“\\”).