How to Use the LIKE Clause in Cypher Queries
09.11.2025
Understanding the LIKE Clause in Cypher Queries
The LIKE clause in Cypher allows you to perform pattern matching on string properties in your graph database. This powerful feature enables you to search for nodes or relationships based on a specific pattern within a property value. Here are some tips on how to effectively use the LIKE clause in your Cypher queries:

1. Basic Syntax
The basic syntax of the LIKE clause in Cypher is as follows:
WHERE node.property_name CONTAINS 'pattern'
2. Case Insensitivity
By default, the LIKE clause in Cypher is case-sensitive. To perform a case-insensitive search, you can use the LOWER() function to convert both the property value and the search pattern to lowercase:
WHERE toLower(node.property_name) CONTAINS toLower('pattern')
3. Wildcard Characters
The LIKE clause supports the use of wildcard characters to represent one or more characters in a search pattern:
%– Represents zero or more characters_– Represents a single character
4. Using Wildcards
To use wildcard characters in your search pattern, you can combine them with the LIKE clause as follows:
WHERE node.property_name CONTAINS 'prefix%'– Matches values starting with ‘prefix’WHERE node.property_name CONTAINS '%suffix'– Matches values ending with ‘suffix’WHERE node.property_name CONTAINS '%keyword%'– Matches values containing ‘keyword’
5. Escaping Wildcard Characters
If you need to search for actual wildcard characters like ‘%’ or ‘_’ in your property values, you can escape them using the backslash (\) character:
WHERE node.property_name CONTAINS '10\% off'
6. Combining Conditions
You can combine the LIKE clause with other conditions in your Cypher queries to create more complex search criteria:
WHERE node.property_name CONTAINS 'pattern' AND node.other_property = value
By mastering the LIKE clause in Cypher, you can efficiently search for specific patterns within your graph database and retrieve the relevant nodes or relationships based on your criteria.