Regex doesn't work correctly

I'm tring to execute this query without succes

MATCH (t:Tweet)
WHERE  
    t.full_text =~ '(?i).*sciacalli.*'  AND
    t.created_at>'2018/01/01' AND t.created_at<'2020/04/25'
RETURN t

The output shuld be this one

"full_text": "RT @catlatorre: Sciacalli.\n
                  Comunque vada sempre sciacalli 
                  siete #KobeBryant https://t.co/******",
"created_at": "2020/01/26 22:49:51",

I don't understand way the regex not match

But if modify the query as follow

MATCH (t:Tweet)
WHERE  
    t.full_text CONTAINS 'sciacalli'  AND
    t.created_at>'2018/01/01' AND t.created_at<'2020/04/25'
RETURN t

I get the correct result. What's wrong ?

can you try to use (?ism).*sciacalli.* ?

s enables dotall mode
m care about multiline

Thanks now it's work. But I don't understand perfectly the difference between i s and m

see https://www.vogella.com/tutorials/JavaRegularExpressions/article.html#specifying-modes-inside-the-regular-expression for a good explanation.

1 Like