def retrieve_by_regex(
      self,
      regex: str,
      add_time: bool = True,
      sort_by_time: bool = True,
  ) -> Sequence[str]:
    """Retrieve memories matching a regex.

    Args:
      regex: a regex to match
      add_time: whether to add time stamp to the output
      sort_by_time: whether to sort the result by time

    Returns:
      List of strings corresponding to memories
    """
    with self._memory_bank_lock:
      data = self._memory_bank[self._memory_bank['text'].str.contains(regex)]

    return self._pd_to_text(data, add_time=add_time, sort_by_time=sort_by_time)
Retrieve memories matching a regex.

    Args:
      regex: a regex to match
      add_time: whether to add time stamp to the output
      sort_by_time: whether to sort the result by time

    Returns:
      List of strings corresponding to memories
    
concordia/associative_memory/deprecated/associative_memory.py