0

I'm new to Neo4j. I want to fetch all nodes whose one of property for example name contains a capital character at any position. I saw the CONTAINS clause provided but was unable to use it with RegEx as Compiler does not accept =~ after CONTAINS keyword in the query. Thanks in advance.

nik
  • 1,464
  • 4
  • 18
  • 32

1 Answers1

2

What about:

MATCH (n)
WHERE n.name =~ '.*[A-Z]+.*'
RETURN n

Ideally, you will want to at least restrict the initial pattern (here: (n)) by a label (let's say: Person):

MATCH (n:Person)
WHERE n.name =~ '.*[A-Z]+.*'
RETURN n

... and create an index for that label and property to speed up the lookup:

CREATE INDEX person_name IF NOT EXISTS FOR (p:Person) ON (p.name)
fbiville
  • 8,407
  • 7
  • 51
  • 79