Xpath で正規表現を使う
node.xpath('.//title[regex(., "\w+")]', Class.new { def regex node_set, regex node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ } end }.new)
参考:
Method: Nokogiri::XML::Searchable#xpath — Documentation for sparklemotion/nokogiri | RubyDoc.info
case-insensitive selector
translate
を使う- カスタム関数を使う
参考:
Nokogiri で case-insensitive な select – Qiita
How can I create a nokogiri case insensitive Xpath selector? – Stack Overflow