# File lib/action_view/helpers/text_helper.rb, line 113
        def excerpt(text, phrase, radius = 100, excerpt_string = "...")
          if text && phrase
            phrase = Regexp.escape(phrase)

            if found_pos = text.chars =~ /(#{phrase})/i
              start_pos = [ found_pos - radius, 0 ].max
              end_pos   = [ [ found_pos + phrase.chars.length + radius - 1, 0].max, text.chars.length ].min

              prefix  = start_pos > 0 ? excerpt_string : ""
              postfix = end_pos < text.chars.length - 1 ? excerpt_string : ""

              prefix + text.chars[start_pos..end_pos].strip + postfix
            else
              nil
            end
          end
        end