require 'open-uri' require "pp" sio = OpenURI.open_uri("https://www.chintai.net/rent/") area = [] sio.each_line do |l| if l =~ %r|rent\/[a-z]+\/ensen| area << l.slice(%r|(rent\/[a-z]+\/ensen)|, 1) end end pp area