apoc.text.indexesOf

Details

Syntax

apoc.text.indexesOf(text, lookup [, from, to ])

Description

Returns all occurrences of the lookup STRING in the given STRING, or an empty list if not found.

Arguments

Name

Type

Description

text

STRING

The string to search for the lookup string in.

lookup

STRING

The lookup string to search for in the given string.

from

INTEGER

The index at which to start the search. The default is: 0.

to

INTEGER

The index at which to stop the search. The default is: -1.

Returns

LIST<ANY>

Usage Examples

RETURN apoc.text.indexesOf("Hello World, Hello, Hello", 'Hello') AS output;
Results
output

[0, 13, 20]

Starting from index 6, find the occurrences of 'Hello',
RETURN apoc.text.indexesOf("Hello World, Hello, Hello", 'Hello', 6) AS output;
Results
output

[13, 20]

Starting from index 6 up to index 20, find the occurrences of 'Hello',
RETURN apoc.text.indexesOf("Hello World, Hello, Hello", 'Hello', 6, 20) AS output;
Results
output

[13]