Skip to main content
Version: 0.9.6

Expr.str.extract

def extract(pattern: IntoExprColumn, group_index: int = 1) -> Expr

Categories: string

Extract a pattern from the string.

Parameters

parameter
pattern

The pattern to extract.

parameter
group_index

The group index to extract.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.extract("(b.b)", 1).alias("extract"))
>>>
┌───────────┬─────────┐
│ a ┆ extract │
------
strstr
╞═══════════╪═════════╡
│ a bAb c d ┆ bAb │
│ bCbb c d ┆ bCb │
│ bb ┆ null │
│ null ┆ null │
└───────────┴─────────┘