Update old URLs in reviewing articles on contests

Updated:

As you know, AtCoder decided to upgrade the contest system from the once-called “beta version” to the current version on December last year.

As I had mentioned in this article, I replaced the old URLs by the current-versioned URLs.

Source code

I executed the following source code.

Dir.glob("*.md").each{|name|
  File.open(name){|file|
    str = file.read
    str.gsub!(/# ソースコード/, "# Source codes")
    str.gsub!(/# 解法のメモ/, "# Solutions")
    str.gsub!(/# その他/, "# Others")
    str.gsub!(/私の提出 \(AtCoder\)/, "My submissions (AtCoder)")
    str.gsub!(/私の解答 \(GitHub\)/, "My source codes (GitHub)")
    match = str.match(/https:\/\/(.+)\.contest\.atcoder\.jp\/submissions\/all\?user_screen_name=kazunetakahashi/)
    if match.nil?
      next
    end
    contest_name = match[1]
    str.gsub!(/https?:\/\/#{contest_name}\.contest\.atcoder\.jp\/submissions\/all\?user_screen_name=kazunetakahashi/, "https://atcoder.jp/contests/#{contest_name}/submissions?f.User=kazunetakahashi")
    str.gsub!(/https?:\/\/#{contest_name}\.contest\.atcoder\.jp/, "https://atcoder.jp/contests/#{contest_name}")
    p str
    File.open(name, 'w'){|output|
      output.puts(str)
    }
  }
}