# xarray.core.accessor_str.StringAccessor.contains

`StringAccessor.``contains`(pat, case=True, flags=0, regex=True)

  Test if pattern or regex is contained within a string of the array.

  Return boolean array based on whether a given pattern or regex is contained within a string of the array.

  Parameters:

  - pat (str) – Character sequence or regular expression.
  - case (bool, default True) – If True, case sensitive.
  - flags (int, default 0 (no flags)) – Flags to pass through to the re module, e.g. re.IGNORECASE.
  - regex (bool, default True) – If True, assumes the pat is a regular expression. If False, treats the pat as a literal string.

  Returns: | contains – An array of boolean values indicating whether the given pattern is contained within the string of each element of the array.
  Return type: | array of bool