StringMethods.match(pat: str, case: bool = True, flags: int = 0) SeriesOrIndex#

Determine if each string matches a regular expression.

patstr or compiled regex

Character sequence or regular expression.

flagsint, default 0 (no flags)

Flags to pass through to the regex engine (e.g. re.MULTILINE)

Series or Index of boolean values.


Parameters case and na are currently not supported. The flags parameter currently only supports re.DOTALL and re.MULTILINE.


>>> import cudf
>>> s = cudf.Series(["rapids", "ai", "cudf"])

Checking for strings starting with a.

>>> s.str.match('a')
0    False
1     True
2    False
dtype: bool

Checking for strings starting with any of a or c.

>>> s.str.match('[ac]')
0    False
1     True
2     True
dtype: bool