Neo4J Cypher – How to Escape Backslashes and Forward Slashes

cypherneo4j

When I run,

MATCH (p:person {id:'1'}), (a:Address {street:"11\34, Wall street"})RETURN p, a;

Invalid input 'S': expected '\', ''', '"', 'b', 'f', 'n', 'r', 't', '_', '%', UTF16 or UTF32

How do I handle \ and / special characters

Best Answer

Don't use double quotes " for a string, use single quotes ' and use double slash \\ to insert single backward slash \. The \ will escape the character after it (like in C).

MATCH (p:person {id:'1'}), (a:Address {street:'11\\34, Wall street'})RETURN p, a;