Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
regexp_match in datafusion::physical_expr::regex_expressions - Rust
[go: Go Back, main page]

pub fn regexp_match<T>(
    args: &[Arc<dyn Array>]
) -> Result<Arc<dyn Array>, DataFusionError>
where T: OffsetSizeTrait,
Expand description

Extract a specific group from a string column, using a regular expression.

The full list of supported features and syntax can be found at https://docs.rs/regex/latest/regex/#syntax

Supported flags can be found at https://docs.rs/regex/latest/regex/#grouping-and-flags

§Examples

let ctx = SessionContext::new();
let df = ctx.read_csv("tests/data/regex.csv", CsvReadOptions::new()).await?;

// use  the regexp_match function to test col 'values',
// against patterns in col 'patterns' without flags
let df = df.with_column(
    "a",
    regexp_match(vec![col("values"), col("patterns")])
)?;
// use the regexp_match function to test col 'values',
// against patterns in col 'patterns' with flags
let df = df.with_column(
    "b",
    regexp_match(vec![col("values"), col("patterns"), col("flags")]),
)?;

// literals can be used as well with dataframe calls
let df = df.with_column(
    "c",
    regexp_match(vec![lit("foobarbequebaz"), lit("(bar)(beque)")]),
)?;

df.show().await?;