Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Pattern Matching Operator =~

Cypher supports regular expression with =~ operator. The =~ operator succeeds only if its pattern matches the entire string.

Examples

RETURN 'abc' =~ 'abc';
True

RETURN 'abc' =~ 'a';
False

RETURN 'abc' =~ '.*(b|d).*';
True

RETURN 'abc' =~ '(b|c).*';
False

Escaping in Regular Expressions

To use special characters (e.g. ., *) without special meaning, escape them with backslash (\).

Example

RETURN '[email protected]' =~ '.*\\.com';
True

Case-insensitive Regular Expressions

To use case-insensitive regular expressions, preappend a regular expression with ?i

Example

RETURN 'abc' =~ '(?i)A.*';
True