Community
    • Login

    help with find and replace (wildcards)

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 18.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Light PortalL Offline
      Light Portal
      last edited by

      Hello, I am repairing some .srt files (subtitles for movies), but it’s tricky. Many different formats.
      In text below, for example, I want to be rid of all {\pos(XXX,XXX.XXX), but I don’t know how to make that in notepad. I tried the wildcards of word and vba, no cigar.

      00:00:14,790 --> 00:00:21,770
      {\pos(201.778,26.666)}战舰波将金号

      12
      00:00:21,770 --> 00:00:25,200
      {\pos(196,170.857)}高斯影业第一制片厂 出品

      13
      00:00:25,200 --> 00:00:28,630
      {\pos(196,195.857)}监制 J·M·布里奥克

      14
      00:00:28,630 --> 00:00:32,180
      {\pos(199,207.857)}编剧
      N·F·阿加兹汉诺瓦·夏科

      15
      00:00:32,190 --> 00:00:38,690
      {\pos(196,225)}导演 S·M·爱森斯坦
      副导演 G·亚力克山德罗夫人

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Light Portal
        last edited by

        @light-portal said in help with find and replace (wildcards):

        I tried the wildcards of word and vba

        Notepad++ does not use Word wildcards or VBA wildcards. It uses a flavor of regular expression (wildcards) known as “Boost regex”. This is documented in the official Notepad++ documentation, which can easily be found through the ? menu in Notepad++, in the entry called Notepad++ Online User Manual. There, you will see a whole page on Searching, with a section on Regular Expressions

        Specifically, in the Find/Replae dialog, you will need to enable the SEARCH MODE = Regular Expression to enable the wildcard feature.

        If i were you, I would search for FIND = {\\pos.*?}. The \\ is used because \ has special meaning to regex, so you need it twice to “escape” it. The .*? means “find 0 or more characters, as few as possible”, so putting it between the pos and the } means it will find up to the first } after the pos. The REPLACE would be blank, because you just want to delete those.

        -—

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • FAQ: Where to find regular expressions (regex) documentation
        • Notepad++ Online User Manual: Searching/Regex
        Light PortalL 1 Reply Last reply Reply Quote 2
        • Light PortalL Offline
          Light Portal @PeterJones
          last edited by

          @peterjones thank you

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors