cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Course: Introduction to Neo4j exercise 4.9 Taking It Further regex solution

Hello. I'm looking for the solution to this exercise using a regular expression. Here are the instructions:

  • Retrieve all movies in the database that have love in their tagline and return the movie titles
  • Retrieve movies in the database, specifying a regular expression for the content of the tagline .
    Here's what I tried:
MATCH (m:Movie)
WHERE m.tagline =~'love'
RETURN m

and

MATCH (m:Movie)
WHERE m.tagline =~'love.*'
RETURN m

Both returned (no changes, no records).
Thanks for any insight. 🙂

1 ACCEPTED SOLUTION

Hello @brucemcminn and welcome to the Neo4j community

Can you try this query?

MATCH (m:Movie)
WHERE m.tagline =~ '(?i).*love.*'
RETURN m.title AS title

You can have more information here.

Regards,
Cobra

View solution in original post

2 REPLIES 2

Hello @brucemcminn and welcome to the Neo4j community

Can you try this query?

MATCH (m:Movie)
WHERE m.tagline =~ '(?i).*love.*'
RETURN m.title AS title

You can have more information here.

Regards,
Cobra

Thanksfor the kind welcome! I learned a little bit more about regex in the last few weeks and see that I need to add the .* at the beginning as well. Using case insensitive (?i) makes it more robust.


Sorry I didn't see your reply sooner.