Skip to main content
Version: 0.9.1

Expr.str.find

def find(pattern: str | Expr, literal: bool = False, strict: bool = True) -> Expr

Categories: string

Find the position of the first occurrence of the given pattern.

Parameters

parameter
pattern

The pattern to search for.

parameter
literal

Take the pattern as a literal string (not a regex).

parameter
strict

if the given pattern is not valid regex, raise an error.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.find("b").alias("find"))
>>>
┌──────┬──────┐
│ a ┆ find │
------
str ┆ u32 │
╞══════╪══════╡
│ a ┆ null │
│ ab ┆ 1
│ b ┆ 0
│ xaby ┆ 2
│ null ┆ null │
└──────┴──────┘