apoc.text.regexGroups

Function

apoc.text.regexGroups(text STRING, regex STRING) - returns all groups matching the given regular expression in the given text.

Signature

apoc.text.regexGroups(text :: STRING, regex :: STRING) :: LIST<ANY>

Input parameters

Name Type Default

text

STRING

null

regex

STRING

null

Usage Examples

RETURN apoc.text.regexGroups(
  'abc <link xxx1>yyy1</link> def <link xxx2>yyy2</link>',
  '<link (\\w+)>(\\w+)</link>'
) AS output;
Table 1. 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;
Table 2. Results
output

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