StringMethods.findall(pat: str, flags: int = 0) SeriesOrIndex#

Find all occurrences of pattern or regular expression in the Series/Index.


Pattern or regular expression.

flagsint, default 0 (no flags)

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


All non-overlapping matches of pattern or regular expression in each string of this Series/Index.


>>> import cudf
>>> s = cudf.Series(['Lion', 'Monkey', 'Rabbit'])

The search for the pattern ‘Monkey’ returns one match:

>>> s.str.findall('Monkey')
0          []
1    [Monkey]
2          []
dtype: list

When the pattern matches more than one string in the Series, all matches are returned:

>>> s.str.findall('on')
0    [on]
1    [on]
2      []
dtype: list

Regular expressions are supported too. For instance, the search for all the strings ending with the word ‘on’ is shown next:

>>> s.str.findall('on$')
0    [on]
1      []
2      []
dtype: list

If the pattern is found more than once in the same string, then multiple strings are returned:

>>> s.str.findall('b')
0        []
1        []
2    [b, b]
dtype: list

Pandas Compatibility Note


The flags parameter currently only supports re.DOTALL and re.MULTILINE.