Skip to content

Commit

Permalink
Document regexp_extract_all(string, pattern) Presto function (faceboo…
Browse files Browse the repository at this point in the history
…kincubator#8689)

Summary:
The documentation for 2-arg regexp_extract_all(string, pattern) function was missing.

Pull Request resolved: facebookincubator#8689

Reviewed By: kevinwilfong

Differential Revision: D53494645

Pulled By: mbasmanova

fbshipit-source-id: 11f83056c5b0ff3b20787db143631b27ba2b5c05
  • Loading branch information
mbasmanova authored and facebook-github-bot committed Feb 7, 2024
1 parent 5f57033 commit e4a2ce2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions velox/docs/functions/presto/regexp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ See https://github.com/google/re2/wiki/Syntax for more information.
SELECT regexp_extract('1a 2b 14m', '\d+'); -- 1

.. function:: regexp_extract(string, pattern, group) -> varchar
:noindex:
:noindex:

Finds the first occurrence of the regular expression ``pattern`` in
``string`` and returns the capturing group number ``group``::

SELECT regexp_extract('1a 2b 14m', '(\d+)([a-z]+)', 2); -- 'a'

.. function:: regexp_extract_all(string, pattern, group) -> array(varchar)
.. function:: regexp_extract_all(string, pattern) -> array(varchar):

Returns the substring(s) matched by the regular expression ``pattern``
in ``string``::

SELECT regexp_extract_all('1a 2b 14m', '\d+'); -- [1, 2, 14]

.. function:: regexp_extract_all(string, pattern, group) -> array(varchar):
:noindex:

Finds all occurrences of the regular expression ``pattern`` in
``string`` and returns the capturing group number ``group``::
Expand Down Expand Up @@ -69,7 +77,7 @@ See https://github.com/google/re2/wiki/Syntax for more information.
SELECT regexp_replace('1a 2b 14m', '\d+[ab] '); -- '14m'

.. function:: regexp_replace(string, pattern, replacement) -> varchar
:noindex:
:noindex:

Replaces every instance of the substring matched by the regular expression
``pattern`` in ``string`` with ``replacement``. Capturing groups can be referenced in
Expand Down

0 comments on commit e4a2ce2

Please sign in to comment.