From: 7stud -- Date: 2012-12-16T19:52:17+09:00 Subject: Re: print - and strip text between tags using Nokogiri This ugly xpath will select the comment based on its text: my_xpath = %Q{/html/body/comment()[. =' body="start" ']/following-sibling::*[not(self::pre)]} -- Posted via http://www.ruby-forum.com/.