Skip to content

Instantly share code, notes, and snippets.

@khacanh
Last active August 29, 2015 14:13
Show Gist options
  • Save khacanh/41692d56df70c2163232 to your computer and use it in GitHub Desktop.
Save khacanh/41692d56df70c2163232 to your computer and use it in GitHub Desktop.
REGEX
cat sentences.js | grep '[^" ], '
# sync subtitle
f = File.open('Raging.Bull.1980.1080p.BluRay.x264.YIFY.srt')
o = File.open('output1.txt', 'w')
while str = f.gets
o.puts str.gsub(/([\d]{2,2},[\d]{3,3})/) { ($1.gsub(',','').to_i + 2000).to_s.rjust(5, '0').insert(2, ',') }
end
f.close
o.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment