Why does question mark blocks case insensitive matching?

match (n) where n.name = 'Okay?Okay?' return n

This can successfully return the node from the graph. However,

match (n) where n.name =~ '(?i)Okay?Okay?' return n

This returns nothing.

Hi @lingvisa

The "=~ '(?i)Okay?Okay?'" is a regular expression.
This question mark in a regular expression means some character.

If you write a backslash before the question mark, it will work correctly.

MATCH (n)
  WHERE n.name =~ '(?i)Okay\?Okay\?'
RETURN n

further detail on regular expressions at WHERE - Cypher Manual

Shouldn't the question mark '?' represent any character? If that's the case, it does not have to be escapeted?

Hi @lingvisa
Sorry, My description was incorrect.
The "any character" is period.
The question mark indicates zero or one occurrences of the preceding element.

You can find "Okay?Okay?", "okay?okay?", "Okay1Okay2", "OkayAOkayB".

MATCH (n)
  WHERE n.name =~ '(?i)Okay.Okay.'
RETURN n