daft.Expression.str.match

daft.Expression.str.match#

Expression.str.match(pattern: str | daft.expressions.expressions.Expression) Expression[source]#

Checks whether each string matches the given regular expression pattern in a string column

Example

>>> df = daft.from_pydict({"x": ["foo", "bar", "baz"]})
>>> df.with_column("match", df["x"].str.match("ba.")).collect()
╭─────────╮
│ match   │
│ ---     │
│ Boolean │
╞═════════╡
│ false   │
├╌╌╌╌╌╌╌╌╌┤
│ true    │
├╌╌╌╌╌╌╌╌╌┤
│ true    │
╰─────────╯
Parameters:

pattern – Regex pattern to search for as string or as a column to pick values from

Returns:

a Boolean expression indicating whether each value matches the provided pattern

Return type:

Expression