pig tutorial - apache pig tutorial - Pig - String extraction using regex ? - pig latin - apache pig - pig hadoop



REGEX_EXTRACT_ALL

  • Performs regular expression matching and extracts all matched groups.

Syntax

REGEX_EXTRACT_ALL (string, regex)

Terms

string The string in which to perform the match.
regex The regular expression.

Usage

  • Use the REGEX_EXTRACT_ALL function to perform regular expression matching and to extract all matched groups. The function uses Java regular expression form.
  • The function returns a tuple where each field represents a matched expression. If there is no match, an empty tuple is returned.

Example

  • This example will return the tuple (192.168.1.5,8020).
REGEX_EXTRACT_ALL('192.168.1.5:8020', '(.*)\:(.*)');

Related Searches to Pig - String extraction using regex