Skip to content

Instantly share code, notes, and snippets.

@kazu0620
Created October 7, 2020 14:25
Show Gist options
  • Save kazu0620/2833da653c24dfb59f4a22c88c4d9935 to your computer and use it in GitHub Desktop.
Save kazu0620/2833da653c24dfb59f4a22c88c4d9935 to your computer and use it in GitHub Desktop.
KindleでExportしたハイライトを整形する
File.open("./words.html"){|f|
f.each_line do |line|
match = line.match(/<div class='noteText'>(.+)<\/h3>/)
if match !=nil
puts match[1]
.gsub(":", "")
.gsub(".", "")
.gsub(")", "")
.gsub("”", "")
.gsub("—", "")
.gsub(",", "")
.strip
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment