Skip to content

Instantly share code, notes, and snippets.

@loadedsith
Created July 22, 2016 01:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loadedsith/5add3a739777ee11aa20c8656d9b515e to your computer and use it in GitHub Desktop.
Save loadedsith/5add3a739777ee11aa20c8656d9b515e to your computer and use it in GitHub Desktop.
Strip YouTube Caption Timestamps with Textmate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>commands</key>
<array>
<dict>
<key>command</key>
<string>selectAll:</string>
</dict>
<dict>
<key>argument</key>
<dict>
<key>action</key>
<string>replaceAll</string>
<key>findString</key>
<string>\d+:\d+:\d+.\d+,\d+:\d+:\d+.\d+</string>
<key>ignoreCase</key>
<true/>
<key>regularExpression</key>
<true/>
<key>replaceAllScope</key>
<string>selection</string>
<key>replaceString</key>
<string></string>
<key>wrapAround</key>
<true/>
</dict>
<key>command</key>
<string>findWithOptions:</string>
</dict>
<dict>
<key>argument</key>
<dict>
<key>action</key>
<string>replaceAll</string>
<key>findString</key>
<string>\n{2,}</string>
<key>ignoreCase</key>
<true/>
<key>regularExpression</key>
<true/>
<key>replaceAllScope</key>
<string>selection</string>
<key>replaceString</key>
<string>\n</string>
<key>wrapAround</key>
<true/>
</dict>
<key>command</key>
<string>findWithOptions:</string>
</dict>
<dict>
<key>argument</key>
<dict>
<key>action</key>
<string>replaceAll</string>
<key>findString</key>
<string>,\s+</string>
<key>ignoreCase</key>
<true/>
<key>regularExpression</key>
<true/>
<key>replaceAllScope</key>
<string>selection</string>
<key>replaceString</key>
<string>,</string>
<key>wrapAround</key>
<true/>
</dict>
<key>command</key>
<string>findWithOptions:</string>
</dict>
</array>
<key>name</key>
<string>Strip Timecodes</string>
<key>uuid</key>
<string>455B3685-5BE8-4E6F-9EAF-B8EF7DB2F252</string>
</dict>
</plist>
@loadedsith
Copy link
Author

It doesn't insert spaces after commas because i thought you asked for your third step to be to remove these spaces. Probably should have asked before I made it that way, lol, as that's an insane thing to request.

You could probably do a simple find and replace for the brackets thing, same as you did for the commas (did you know you could replace with multiple lines? you can).

If you'll need this in the future I bet I could modify them, but I assume this is probably close enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment