#!/usr/local/bin/ruby require 'pp' #https://anond.hatelabo.jp/archive/200609 #https://anond.hatelabo.jp/archive/201708 url = "https://anond.hatelabo.jp/archive/" year_urls = [] (6..17).each do |n| n = "0" + n.to_s unless n.to_s =~ %r|^[1][0-7]$| year = "20" + n.to_s year_urls << url + year end #pp year_urls year_month_urls = [] year_urls.each do |year_url| (0..12).each do |n| # n = "0" + n.to_s unless n =~ %r|^[0-9][0-2]$| #integerオブジェクトは正規表現マッチできなかったから注意 n = "0" + n.to_s unless n.to_s =~ %r|^[0-9][0-2]$| year_month_urls << year_url + n.to_s end end #pp year_month_urls future = [ "201709", "201710", "201711", "201712", ] =begin future = [ 201709, 201710, 201711, 201712, ] =end pp future =begin =end year_month_urls_sample = [ "https://anond.hatelabo.jp/archive/200609", "https://anond.hatelabo.jp/archive/201708" ] pp year_month_urls_sample year_month_urls_from_200609_to_201708 = [] #year_month_urls_sample.each do |year_month_url| #year_month_urls.each do |year_month_url| # puts year_month_url # future.each do |f| # year_month_urls_from_200609_to_201708 << year_month_url unless year_month_url =~ |f| # end #end #pp year_month_urls_from_200609_to_201708