class_docstr: List derivative with a special access attributes.
  
  These are normal lists, but with the special attributes:
  
  * .l (or .list) : value as list (the list itself).
  * .n (or .nlstr): value as a string, joined on newlines.
  * .s (or .spstr): value as a string, joined on spaces.
  * .p (or .paths): list of path objects (requires path.py package)
  
  Any values which require transformations are computed only once and
  cached.
class_docstr_tok: ["List","derivative","with","a","special","access","attributes",".","These","are","normal","lists",",","but","with","the","special","attributes",":","*",".l","(","or",".list",")",":","value","as","list","(","the","list","itself",")",".","*",".n","(","or",".nlstr",")",":","value","as","a","string",",","joined","on","newlines",".","*",".s","(","or",".spstr",")",":","value","as","a","string",",","joined","on","spaces",".","*",".p","(","or",".paths",")",":","list","of","path","objects","(","requires","path.py","package",")","Any","values","which","require","transformations","are","computed","only","once","and","cached","."]
docstr: Return all strings matching 'pattern' (a regex or callable)
  
  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)
docstr_tok: ["Return","all","strings","matching","'pattern","'","(","a","regex","or","callable",")","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",")"]
code: def grep(self, pattern, prune=False, field=None):
      """Return all strings matching 'pattern' (a regex or callable)
  
      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)
      """
  
      def match_target(s):
          if field is None:
              return s
          parts = s.split()
          try:
              tgt = parts[field]
              return tgt
          except IndexError:
              return ""
  
      if isinstance(pattern, py3compat.string_types):
          pred = lambda x: re.search(pattern, x, re.IGNORECASE)
      else:
          pred = pattern
      if not prune:
          return SList([el for el in self if pred(match_target(el))])
      else:
          return SList(
              [el for el in self if not pred(match_target(el))]
          )
  
imports: from __future__ import absolute_import
  import os
  import re
  import sys
  import textwrap
  from string import Formatter
  from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest
  from IPython.utils import py3compat
label_desc: Use image node_id 5 for calling the SList obj's underlying member method code with example usage: obj.grep(pattern, prune, field) and returns: SList, SList, s, tgt, str