Currnetly I am doing
words = []
words << "philip morris"
words << "Philip morris"
words << "philip Morris"
words << "Philip Morris"
for word in words
doc.search("[text()*='#{word}']")
end
When I was using hpricot I found where to downcase the results within the gem so I could just keep all my searchs lowercase, however nokogiri has been quite difficult to find where one could even do that. Is anyone aware of a way to do this?
Thank you very much for your time
The
lower-caseXPath function is not available but you can use thetranslateXPath 1.0 function to convert your text to lowercase e.g. for the English alphabet:I couldn’t seem to use this in combination with the
*=operator but you can usecontainsto do a substring search instead, making the full thing: