Series.str.match(pat, case: bool = True, flags: int = 0, na=None)#

Determine if each string starts with a match of a regular expression.

  • pat (str) – Character sequence or regular expression.

  • case (bool, default True) – If True, case sensitive.

  • flags (int, default 0 (no flags)) – Regex module flags, e.g. re.IGNORECASE.

  • na (scalar, optional) – Fill value for missing values. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.

Return type

Series/Index/array of boolean values

See also


Stricter matching that requires the entire string to match.


Analogous, but less strict, relying on re.search instead of re.match.


Extract matched groups.


>>> ser = pd.Series(["horse", "eagle", "donkey"])  
>>> ser.str.match("e")  
0   False
1   True
2   False
dtype: bool

This docstring was copied from pandas.core.strings.accessor.StringMethods.