I am trying to combine nodes in a Neo4j database. Nodes have a name property, and I use a regular expression in Cypher to match this. I only want to combine whole words, so "javascript" should not match if I put the string "java". If the string matches multiple words, that is, a “java script”, I will make two separate requests, one for “java” and one for “script”.
This is what I have so far:
match (n) where n.name =~ '(?i).*\\bMYSTRING\\b.*' return n
This works, but it does not work with some special characters like "+" or "#". So I can not find "C ++" or "C #", etc. The regular expression in the above code just uses \ b for the word boundary. it also runs away, so it works correctly.
I tried some versions of this post: regex to match a word boundary starting with special characters , but it really didn't work, maybe I did something wrong.
How can I make this work special characters in Cypher and Neo4j?
source share