# File lib/action_view/helpers/text_helper.rb, line 100 def highlight(text, phrases, *args) options = args.extract_options! unless args.empty? options[:highlighter] = args[0] || '<strong class="highlight">\1</strong>' end options.reverse_merge!(:highlighter => '<strong class="highlight">\1</strong>') if text.blank? || phrases.blank? text else match = Array(phrases).map { |p| Regexp.escape(p) }.join('|') text.gsub(/(#{match})(?!(?:[^<]*?)(?:["'])[^<>]*>)/i, options[:highlighter]) end end