No problem. when your brain becomes almost three-quarters of a century old it does it good to weather a storm from time to time.
I’m currently creating a web-app to do the accounting for my golf club and had just finished doing some coding involving regular expressions when I saw this query of @MusicalBox 's and thought, “Notepad++ can do that with the relevant regular expression” and decided to give it a try.
Hi @elusien, sorry, it’s not working for me. I am probably being very stupid and doing something very wrong!! It seems to just delete every 4th line… leaving Line 1 and Line 2 (timestamp)…
Yes you are correct, that regular expression is designed to extract the subtitles by deleting the controls (number-of-subtitle and time-and-duration) as well as any blank lines.
Regular expressions are used in a whole load of situations. I use them a lot when coding in Javascript or PHP, but they are supported by many programming languages. Regular expressions are also used in search engines), in search and replace dialogs of word procssors and text editors, in text processing utilties e.g. Sed and Awk and in lexical analysis.
A good place to learn about them is given below. But crafting regular expressions seems to be more of an art than science. One very useful website for creating and testing them is:
^ Start at the beginning (first character) of a line;
\d* Match any number of digits [0-9] followed immediately by: (\r\n|\r|\n) a CRLF or a CR or a LF
or
(\r\n|\r|\n){2} Match 1 blank line or 2 blank lines
or
[\d:,. >-]* Match the time codes which have digits, colons, commas, periods, spaces, greater-than symbols and minus signs that are immediately followed by: (\r\n|\r|\n) a CRLF or a CR or a LF
And then replace them with nothing i.e. delete them.
I think this is a little bit too advanced for me
But I’ll have a look at the links you shared anyway.
Hopefully I won’t blow blood vessels in my brain while trying to understand that stuff
Oh yes, of course!! I knew I was stupid!!! I mistakenly imagined it worked by the same principle of AHK - ie removing lines, not looking for types of characters. Thanks @musicalbox!
Ingenious!
Brilliant, thanks for that handy tutorial, @elusien. Very interesting!