# File lib/scrubyt/utils/simple_example_lookup.rb, line 17
    def self.find_node_from_text(doc, text, next_link=false, index = 0)
      text.gsub!('ยป', '»')
      #Process immediate attribute extraction (like "go to google.com/@href")
      if text =~ /.+\/@.+$/
        text = text.scan(/^(.+?)\/@.+$/)[0][0]
      elsif text =~ /.+\[\d+\]$/
        res = text.scan(/(.+)\[(\d+)\]$/)
        text = res[0][0]
        index = res[0][1].to_i
      elsif text =~ /.+\[.+\]$/
        final_element_name = text.scan(/^(.+?)\[/)[0][0]
        text = text.scan(/\[(.+?)\]/)[0][0]
      end
      if final_element_name
        text = Regexp.escape(text) if text.is_a? String
        result = SharedUtils.traverse_for_match(doc,/#{text}/)[index]
        result = XPathUtils.traverse_up_until_name(result,final_element_name)
      else
        text = Regexp.escape(text) if text.is_a? String
        result = SharedUtils.traverse_for_match(doc,/^#{text}$/)[index]
      end
    end