original_docstring: Find history items which match a given regular expression
  
          :param regex: the regular expression to search for.
          :return: a list of history items, or an empty list if the string was not found
          
docstring: Find history items which match a given regular expression
docstring_tokens: Find history items which match a given regular expression
code: def regex_search(self, regex: str) -> List[HistoryItem]:
          """Find history items which match a given regular expression
  
          :param regex: the regular expression to search for.
          :return: a list of history items, or an empty list if the string was not found
          """
          regex = regex.strip()
          if regex.startswith(r'/') and regex.endswith(r'/'):
              regex = regex[1:-1]
          finder = re.compile(regex, re.DOTALL | re.MULTILINE)
  
          def isin(hi):
              """filter function for doing a regular expression search of history"""
              return finder.search(hi) or finder.search(hi.expanded)
          return [itm for itm in self if isin(itm)]
code_tokens: def regex_search ( self , regex : str ) -> List [ HistoryItem ] : regex = regex . strip ( ) if regex . startswith ( r'/' ) and regex . endswith ( r'/' ) : regex = regex [ 1 : - 1 ] finder = re . compile ( regex , re . DOTALL | re . MULTILINE ) def isin ( hi ) : """filter function for doing a regular expression search of history""" return finder . search ( hi ) or finder . search ( hi . expanded ) return [ itm for itm in self if isin ( itm ) ]
short_docstring: Find history items which match a given regular expression
short_docstring_tokens: Find history items which match a given regular expression
comment: """Find history items which match a given regular expression
  
          :param regex: the regular expression to search for.
          :return: a list of history items, or an empty list if the string was not found
          """$SEP$"""filter function for doing a regular expression search of history"""