Skip to main content
`Ctrl`+`K`

# pandas.api.types.is_re_compilable

pandas.api.types.is_re_compilable(obj)

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

  This function attempts to compile `obj` as a regular expression using `re.compile()` and returns whether the compilation succeeds.

  Parameters:
    obj The object to check

      The object to check if the object can be compiled into a regex pattern instance.

  Returns:
    bool

      Whether obj can be compiled as a regex pattern.

  See also

  `api.types.is_re`

    Check if the object is a regex pattern instance.

  Examples

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