Function arrow::compute::kernels::comparison::regexp_is_match_scalar
source · pub fn regexp_is_match_scalar<'a, S>(
array: &'a S,
regex: &str,
flag: Option<&str>,
) -> Result<BooleanArray, ArrowError>where
&'a S: StringArrayType<'a>,
Expand description
Return BooleanArray indicating which strings in an array match a single regular expression.
This is equivalent to the SQL array ~ regex_array
, supporting
StringArray
/ LargeStringArray
/ StringViewArray
and a scalar.
See the documentation on regexp_is_match
for more details on arguments
§See Also
regexp_is_match
for matching an array of regular expression against an array of stringsregexp_match
for extracting groups from a string array based on a regular expression
§Example
// array of strings to match
let array = StringArray::from(vec!["Foo", "Bar", "FooBar", "Baz"]);
let regexp = "^Foo"; // regular expression to match against
let flags: Option<&str> = None; // flags can control the matching behavior
// The result is a BooleanArray indicating when each string in `array`
// matches the regular expression `regexp`
let result = regexp_is_match_scalar(&array, regexp, None).unwrap();
assert_eq!(result, BooleanArray::from(vec![true, false, true, false]));