pandas.Series.str.match

pandas 3.1.1 · Series and accessors · method

Test for a regex match at the beginning of each string.

Call syntax

Series.str.match(pat, case=…, flags=…, na=…)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
pat Required
Positional or keyword
str or compiled regex

Specify the substring or regular expression to match.

case Optional
Positional or keyword
bool

Choose whether uppercase and lowercase text are treated as distinct.

flags Optional
Positional or keyword
int

Pass regular-expression modifiers such as re.IGNORECASE.

na Optional
Positional or keyword
scalar

Supply the value to use for records whose input is missing.

Returns

Series/Index/array of boolean values