cudf.core.column.string.StringMethods.match#

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

Determine if each string matches a regular expression.

Parameters
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)

Returns
Series or Index of boolean values.

Notes

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

Examples

>>> 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