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. :)

Hello @brucemcminn and welcome to the Neo4j community :slight_smile:

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

1 Like

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.