open it in a text editor that supports find and replace function
and regex option
then search for
<code>[(.*?)]</code>
and replace it with a blank
you might be left with square brackets - if so search and replace those
regex is a pain and looks complicated but damn thing has good uses
i commited the grave mistake of experiencing regex in php.
it was pure bliss. it really shows you that regex can be an efficient and powerful tool.
i just cant bring myself to deal with other implementations thereof anymore
for some fucking reason everyone needs to put their fucking twist to the damn thing
when hearing "regex" i always go oh nooooooo
[...]
this actually works lmao
it should work depending on editor slight change to / is required
Larping retards on this board really call regex complicated because of the need to use escape characters.
screw your regex larping and your escape memes
3 weeks ago
Anonymous
t. jobless neet teen
3 weeks ago
Anonymous
the amount of people i met that has not copypastad regex is minimal.
be proud of yourself.
open it in a text editor that supports find and replace function
and regex option
then search for
<code>[(.*?)]</code>
and replace it with a blank
you might be left with square brackets - if so search and replace those
regex is a pain and looks complicated but damn thing has good uses
i commited the grave mistake of experiencing regex in php.
it was pure bliss. it really shows you that regex can be an efficient and powerful tool.
i just cant bring myself to deal with other implementations thereof anymore
for some fucking reason everyone needs to put their fucking twist to the damn thing
def remove_subtitles_with_brackets(input_file, output_file):
try:
with open(input_file, 'r', encoding='utf-8') as infile, open(output_file, 'w', encoding='utf-8') as outfile:
subtitle_text = ''
is_subtitle_to_remove = False
for line in infile:
if re.match(r'd+:d+:d+,d+ --> d+:d+:d+,d+', line): # Match timecodes
if is_subtitle_to_remove:
is_subtitle_to_remove = False
continue
else:
outfile.write(subtitle_text)
subtitle_text = ''
else:
subtitle_text += line
if "[" in line and "]" in line:
is_subtitle_to_remove = True
# Write the last subtitle
outfile.write(subtitle_text)
print(f"Subtitles with brackets removed. Saved to {output_file}")
except FileNotFoundError:
print("File not found. Please check the file path.")
except Exception as e:
print(f"An error occurred: {str(e)}")
if __name__ == "__main__":
input_file = "input.srt" # Replace with your input file path
output_file = "output.srt" # Replace with your output file path
>open subtitles folder in any modern text editor >ctrl shift h >type [ in the upper box >type nothing in the next box >click replace >repeat for ]
at this pace itoddlers will soon need an app to help them breathe
ty
[...]
when hearing "regex" i always go oh nooooooo
[...]
it should work depending on editor slight change to / is required
[...]
screw your regex larping and your escape memes
like with many things
its actually pretty simple
but people made it complicated
>but people made it complicated
i never went through any study or exercises for it. maybe i should so that other anon does not get a chance to make funny about me (i QQ now ... meh tears of shame)
>i never went through any study or exercises for it
me neither.
and they wrote friggin entire books about awk and sed.
but thats the exact reason i wont study it.
theres a slightly different regex for each application that uses it.
cant be arsed to do much more than cheat-sheeting my way through.
pearl compatible regex expresions are like sex.
and it is all i care to learn.
fucking nerds just had to decide on an universal standard
If there were a universal standard it would probably be POSIX regular expressions but those are pretty weak compared to PCRE power, which at least is available as a C library you can embed basically everywhere (libpcre2)
https://subtitletools.com/srt-cleaner
srt-cleaner does it but i want an off-line solution
I would do that in Emacs with a simpy query-replace but you can also use sed from the terminal
regular expression find and replace
note you must escape square brackets if you want them to be literal in regex otherwise it represents a character class
>regex, the mother of all rabbitholes
write a python script
its 10 lines of code max
open it in a text editor that supports find and replace function
and regex option
then search for
<code>[(.*?)]</code>
and replace it with a blank
you might be left with square brackets - if so search and replace those
regex is a pain and looks complicated but damn thing has good uses
[(.*?)]
what is the "code" box tags for LULZ? too late now.
LULZ code uses square brackets not angle brackets, like bbcode
ty
when hearing "regex" i always go oh nooooooo
it should work depending on editor slight change to / is required
screw your regex larping and your escape memes
t. jobless neet teen
the amount of people i met that has not copypastad regex is minimal.
be proud of yourself.
to
screw regex yet again
this actually works lmao
i commited the grave mistake of experiencing regex in php.
it was pure bliss. it really shows you that regex can be an efficient and powerful tool.
i just cant bring myself to deal with other implementations thereof anymore
for some fucking reason everyone needs to put their fucking twist to the damn thing
PHP is just PCRE which you can use in many languages.
I wish it had regex literals like js
>pearl compatible regular expressions
thanks anon
if i will have to use some regex, ill look for that
import re
def remove_subtitles_with_brackets(input_file, output_file):
try:
with open(input_file, 'r', encoding='utf-8') as infile, open(output_file, 'w', encoding='utf-8') as outfile:
subtitle_text = ''
is_subtitle_to_remove = False
for line in infile:
if re.match(r'd+:d+:d+,d+ --> d+:d+:d+,d+', line): # Match timecodes
if is_subtitle_to_remove:
is_subtitle_to_remove = False
continue
else:
outfile.write(subtitle_text)
subtitle_text = ''
else:
subtitle_text += line
if "[" in line and "]" in line:
is_subtitle_to_remove = True
# Write the last subtitle
outfile.write(subtitle_text)
print(f"Subtitles with brackets removed. Saved to {output_file}")
except FileNotFoundError:
print("File not found. Please check the file path.")
except Exception as e:
print(f"An error occurred: {str(e)}")
if __name__ == "__main__":
input_file = "input.srt" # Replace with your input file path
output_file = "output.srt" # Replace with your output file path
remove_subtitles_with_brackets(input_file, output_file)
wtf is that you fucking zoomie
have you all not heard of sed?
>open subtitles folder in any modern text editor
>ctrl shift h
>type [ in the upper box
>type nothing in the next box
>click replace
>repeat for ]
at this pace itoddlers will soon need an app to help them breathe
you can probably do it just by changing lines starting with [ to a blank line, so:
sed -i 's/[.*//g' filename
Larping retards on this board really call regex complicated because of the need to use escape characters.
your mom should have escaped you
like with many things
its actually pretty simple
but people made it complicated
>but people made it complicated
i never went through any study or exercises for it. maybe i should so that other anon does not get a chance to make funny about me (i QQ now ... meh tears of shame)
>i never went through any study or exercises for it
me neither.
and they wrote friggin entire books about awk and sed.
but thats the exact reason i wont study it.
theres a slightly different regex for each application that uses it.
cant be arsed to do much more than cheat-sheeting my way through.
pearl compatible regex expresions are like sex.
and it is all i care to learn.
fucking nerds just had to decide on an universal standard
>universal standard
that would be nice.
the one advantage of design by committee
but the alternative is what the fuck ever regex came to be or a corporate monopoly dictating a standard
its all cancer it just hits a different organ
If there were a universal standard it would probably be POSIX regular expressions but those are pretty weak compared to PCRE power, which at least is available as a C library you can embed basically everywhere (libpcre2)
aah so thats how the sausage was made
posix failed and then people picked up the pieces, kek
emacs has a macro for generating regexes with human readable syntax. not my problem :^)
t. vscodlet
yt-dlp url --embed-subs
is there a way to remove all the bracket subtitles from the vtt/srt before it embeds the subs?
ask chatgpt unironically will give you the correct answer
I just use sed. doesn't get much easier than that.