Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
行全体を印刷する代わりにOK:
<von_icd_code V="A00"/>
V=".." の間のテキストのみを抽出したいのですが、この場合は A00
使用するNokogiri::XML::Document
Nokogiri::XML::Document
require 'nokogiri' doc = Nokogiri::XML::Document.parse('<von_icd_code V="A00"/>') doc.at("von_icd_code")["V"] # => "A00"
Like this:
'<von_icd_code V="A00"/>'.scan(/V="(.+)"/)[0][0] => "A00"