REGEX_NAMED_GROUPS

Matches the regular expression on the input string. Returns the record with field names and group names.

Syntax

REGEX_NAMED_GROUPS(pattern, allMatches, filterEmpty, input)

Arguments

Examples

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME
    SELECT pattern, allMatches, filterEmpty, input,
        REGEX_NAMED_GROUPS('^(?:(?<scheme>.*?):\/)?\/?(?<domain>[^:\/\s]+)(?::(?<port>\d*))?(?:(\/\w+)*\/)(?<page>[\w\-\.]+[^#?\s]+)(?:.*)?$', false, false, input) AS Output
    FROM default_glue_catalog.upsolver_samples.orders_raw_data
    LET pattern = '^(?:(?<scheme>.*?):\/)?\/?(?<domain>[^:\/\s]+)(?::(?<port>\d*))?(?:(\/\w+)*\/)(?<page>[\w\-\.]+[^#?\s]+)(?:.*)?$',
        allMatches = false,
        filterEmpty = false,
        input = 'https://www.domain.com/page.html'
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 1;

Query result

Last updated