W3cubDocs

/pandas 2

pandas.api.types.is_re_compilable

pandas.api.types.is_re_compilable(obj)[source]

Check if the object can be compiled into a regex pattern instance.

Parameters:
obj:The object to check
Returns:
bool

Whether obj can be compiled as a regex pattern.

Examples

>>> from pandas.api.types import is_re_compilable
>>> is_re_compilable(".*")
True
>>> is_re_compilable(1)
False

© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.api.types.is_re_compilable.html