module Nokogiri::XML::Searchable

def search(*args)

See Searchable#xpath and Searchable#css for further usage help.

node.search('.//title[nokogiri:regex(., "\w+")]', 'div.employee:regex("[0-9]+")', handler)
}.new
end
node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ }
def regex node_set, regex
handler = Class.new {

list. For example:
are ones that you pass in. Note that this class may appear anywhere in the argument
The first argument to the method will be the current matching NodeSet. Any other arguments

`nokogiri` namespace in XPath queries.
functions create a class and implement the function you want to define, which will be in the
💡 Custom XPath functions and CSS pseudo-selectors may also be defined. To define custom

node.search('.//address[@domestic=$value]', nil, {:value => 'Yes'})

bindings. For example:
For XPath queries, a hash of variable bindings may also be appended to the namespace

node.search('bike|tire', {'bike' => 'http://schwinn.com/'})
node.search('.//bike:tire', {'bike' => 'http://schwinn.com/'})

A hash of namespace bindings may be appended:

node.search("div.employee", ".//title")

Search this object for +paths+. +paths+ must be one or more XPath or CSS queries:

search(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class])
call-seq:
##
def search(*args)
  paths, handler, ns, binds = extract_params(args)
  xpaths = paths.map(&:to_s).map do |path|
    LOOKS_LIKE_XPATH.match?(path) ? path : xpath_query_from_css_rule(path, ns)
  end.flatten.uniq
  xpath(*(xpaths + [ns, handler, binds].compact))
end