regexp_extract {SparkR}R Documentation

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 signature 'Column,character,numeric'
regexp_extract(x, pattern, idx)

Arguments

x

a string Column.

pattern

a regular expression.

idx

a group index.

Note

regexp_extract since 1.5.0

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

## Not run: regexp_extract(df$c, '(\d+)-(\d+)', 1)

[Package SparkR version 2.2.3 Index]