apoc.text.regexGroups

Function APOC Core

apoc.text.regexGroups(text, regex) - return all matching groups of the regex on the given text.

Signature

apoc.text.regexGroups(text :: STRING?, regex :: STRING?) :: (LIST? OF 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"]]