以下の内容はhttps://tbpgr.hatenablog.com/entry/20120605/1338910624より取得しました。


書籍 Regular Expressions Cookbook | Remove Duplicate Lines

パンくず

書籍 Regular Expressions Cookbook
Remove Duplicate Lines

概要

重複行の削除について

サンプル

str =<<"EOS"
line1
line1
line2
EOS

puts str
puts "------------------------------------"
print str.gsub(/^(.*)(?:(?:\r?\n|\n)\1)+/,"")

出力

line1
line1
line2
------------------------------------

line2



以上の内容はhttps://tbpgr.hatenablog.com/entry/20120605/1338910624より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14