SparkR (version 2.1.2)

regexp_extract: regexp_extract

Description

Extract a specific idx group identified by a Java regex, from the specified string column. If the regex did not match, or the specified group did not match, an empty string is returned.

Usage

regexp_extract(x, pattern, idx)

# S4 method for Column,character,numeric regexp_extract(x, pattern, idx)

Arguments

x

a string Column.

pattern

a regular expression.

idx

a group index.

See Also

Other string_funcs: ascii, base64, concat_ws, concat, decode, encode, format_number, format_string, initcap, instr, length, levenshtein, locate, lower, lpad, ltrim, regexp_replace, reverse, rpad, rtrim, soundex, substring_index, translate, trim, unbase64, upper

Examples

Run this code
# NOT RUN {
regexp_extract(df$c, '(\d+)-(\d+)', 1)
# }

Run the code above in your browser using DataLab