#!/usr/local/bin/ruby 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| short_url = l.slice(%r|(rent/[a-z]+/ensen)|, 1) area << "https://www.chintai.net/#{short_url/}" end end pp area