Function datafusion_functions::regex::regexplike::regexp_like
source · pub fn regexp_like<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef>
Expand description
Tests a string using a regular expression returning true if at least one match, false otherwise.
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_like function to test col 'values',
// against patterns in col 'patterns' without flags
let df = df.with_column(
"a",
regexp_like(vec![col("values"), col("patterns")])
)?;
// use the regexp_like function to test col 'values',
// against patterns in col 'patterns' with flags
let df = df.with_column(
"b",
regexp_like(vec![col("values"), col("patterns"), col("flags")])
)?;
// literals can be used as well with dataframe calls
let df = df.with_column(
"c",
regexp_like(vec![lit("foobarbequebaz"), lit("(bar)(beque)")])
)?;
df.show().await?;