bundles / IPython 9.18.0.dev / IPython / utils / text / SList / grep
function
IPython.utils.text:SList.grep
source: /IPython/utils/text.py:142
Signature
def grep(self, pattern: str | Callable[[Any], re.Match[str] | None], prune: bool = False, field: int | None = None) → SelfSummary
Return all strings matching 'pattern' (a regex or callable)
Extended Summary
This is case-insensitive. If prune is true, return all items NOT matching the pattern.
If field is specified, the match must occur in the specified whitespace-separated field.
Examples
a.grep( lambda x: x.startswith('C') ) a.grep('Cha.*log', prune=1) a.grep('chm', field=-1)
Aliases
IPython.core.interactiveshell.SList.grep