apoc.text.regexGroups

Details

Syntax

apoc.text.regexGroups(text, regex)

Description

Returns all groups matching the given regular expression in the given text.

Arguments

Name

Type

Description

text

STRING

The text to extract matches from.

regex

STRING

The regex pattern to match.

Returns

LIST<ANY>

Usage Examples

RETURN apoc.text.regexGroups(
  'abc <link xxx1>yyy1</link> def <link xxx2>yyy2</link>',
  '<link (\\w+)>(\\w+)</link>'
) AS output;
Results
output

[["<link xxx1>yyy1</link>", "xxx1", "yyy1"], ["<link xxx2>yyy2</link>", "xxx2", "yyy2"]]

RETURN apoc.text.regexGroups(
  'Michael: 1234\nJennifer: 5678',
  '(\\w+): (\\d+)'
) AS output;
Results
output

[["Michael: 1234", "Michael", "1234"], ["Jennifer: 5678", "Jennifer", "5678"]]