# File lib/scrubyt/core/scraping/filters/text_filter.rb, line 4
    def evaluate(source)
        return find_string(source) if @example =~ /^find\(/
        final_element_name = @example.scan(/^(.+?)\[/)[0][0]
        text = Regexp.escape(@example.scan(/\[(.+?)\]/)[0][0])

        index = @example.scan(/\]:(.+)/).flatten
        index = 0 if index.empty?
        index = index[0].to_i unless index[0] == "all"
        result = (index.is_a? Fixnum) ? (SharedUtils.traverse_for_match(source,/#{text}/)[index]) : (SharedUtils.traverse_for_match(source,/#{text}/))
        return "" unless result

        if index[0] == "all"
          result.inject([]) {|a,r| a << XPathUtils.traverse_up_until_name(r,final_element_name); a}
        else
          [XPathUtils.traverse_up_until_name(result,final_element_name)]
        end
    end