is there a way to get rid of these bracket subtitles from srt files using aspell or some other program?

is there a way to get rid of these bracket subtitles from srt files using aspell or some other program?

  1. 3 weeks ago
    Anonymous

    https://subtitletools.com/srt-cleaner

    srt-cleaner does it but i want an off-line solution

  2. 3 weeks ago
    Anonymous

    I would do that in Emacs with a simpy query-replace but you can also use sed from the terminal

  3. 3 weeks ago
    Anonymous

    regular expression find and replace

  4. 3 weeks ago
    Anonymous

    note you must escape square brackets if you want them to be literal in regex otherwise it represents a character class

    • 3 weeks ago
      Anonymous

      >regex, the mother of all rabbitholes

      https://i.imgur.com/eprS0GD.png

      is there a way to get rid of these bracket subtitles from srt files using aspell or some other program?

      write a python script
      its 10 lines of code max

      • 3 weeks ago
        Anonymous

        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

        • 3 weeks ago
          Anonymous

          [(.*?)]

          what is the "code" box tags for LULZ? too late now.

          • 3 weeks ago
            Anonymous

            LULZ code uses square brackets not angle brackets, like bbcode

            • 3 weeks ago
              Anonymous

              ty

              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.

              • 3 weeks ago
                Anonymous

                to
                screw regex yet again

          • 3 weeks ago
            Anonymous

            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

            this actually works lmao

        • 3 weeks ago
          Anonymous

          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

          • 3 weeks ago
            Anonymous

            PHP is just PCRE which you can use in many languages.
            I wish it had regex literals like js

            • 3 weeks ago
              Anonymous

              >pearl compatible regular expressions
              thanks anon
              if i will have to use some regex, ill look for that

  5. 3 weeks ago
    Anonymous

    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)

    • 3 weeks ago
      Anonymous

      wtf is that you fucking zoomie
      have you all not heard of sed?

  6. 3 weeks ago
    Anonymous

    >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

  7. 3 weeks ago
    Anonymous

    you can probably do it just by changing lines starting with [ to a blank line, so:
    sed -i 's/[.*//g' filename

  8. 3 weeks ago
    Anonymous

    Larping retards on this board really call regex complicated because of the need to use escape characters.

    • 3 weeks ago
      Anonymous

      your mom should have escaped you

      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

      • 3 weeks ago
        Anonymous

        >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)

        • 3 weeks ago
          Anonymous

          >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

          • 3 weeks ago
            Anonymous

            >universal standard
            that would be nice.

            • 3 weeks ago
              Anonymous

              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

          • 3 weeks ago
            Anonymous

            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)

            • 3 weeks ago
              Anonymous

              aah so thats how the sausage was made
              posix failed and then people picked up the pieces, kek

          • 3 weeks ago
            Anonymous

            emacs has a macro for generating regexes with human readable syntax. not my problem :^)

            • 3 weeks ago
              Anonymous

              t. vscodlet

  9. 3 weeks ago
    Anonymous

    yt-dlp url --embed-subs

    is there a way to remove all the bracket subtitles from the vtt/srt before it embeds the subs?

  10. 3 weeks ago
    Anonymous

    ask chatgpt unironically will give you the correct answer

  11. 3 weeks ago
    Anonymous

    I just use sed. doesn't get much easier than that.

Your email address will not be published. Required fields are marked *