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:

Amazon.com: Graph Data Processing with Cypher: A practical guide ...

1. Basic Syntax

The basic syntax of the LIKE clause in Cypher is as follows:

13 – Boost Your Neo4j with User-Defined Procedures – YouTube
Oct 4, 2022 … Speaker: Michael Hunger, Senior Director, User Innovation, Neo4j Session type: Full Length Abstract: Cypher is a great, powerful query …
  • 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.

Do you like the article?

Yan Hadzhyisky

fullstack PHP+JS+REACT developer