Community
    • Login

    Finding a value in one line and prepending it to the next line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 522 Views 1 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.
    • MaximillianMM Offline
      MaximillianM
      last edited by

      Hi, I would like to do a find in one line and then prepend that value to a line right after that line.
      I’ve found this regex
      Find (my value) [\r\n]+([^\r\n]+)
      Replace \r00:05 min \1

      The challenge is the value I’m trying to find “00:05” is in a time stamp in the form 00:05:05:001

      When I use find and replace with only using as in 05[\r\n]+([^\r\n]+) it works, but returns too many values. When I use the full value I need to find 00:05: 00:05:[\r\n]+([^\r\n]+)it returns no values found. I’m guessing the : with the regex messes up the find.

      Can you see where my error is?

      Thanks

      Below is some more detail if that helps.

      Here is a sample of the text I am searching

      110
      00:04:59.335 --> 00:05:01.725
      So, welcome to this video

      111
      00:05:01.825 --> 00:05:05.525
      If you have any questions

      So the regex would find the 00:05 in the first timestamp and then prepend it to the next line. Note: the first 00:05 could also be in the beginning of the line.

      110
      00:04:59.335 --> 00:05:01.725
      00:05 min So, welcome to this video

      Thanks Again

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @MaximillianM
        last edited by

        @MaximillianM said in Finding a value in one line and prepending it to the next line:

        00:05:[\r\n]+([^\r\n]+)

        You want:

        Find what: (00:05:[^\r\n]+[\r\n]+)
        Replace with: \100:05 min

        Though you can’t see it here, there is a space after min.

        MaximillianMM 1 Reply Last reply Reply Quote 3
        • MaximillianMM Offline
          MaximillianM @Coises
          last edited by

          @Coises said in Finding a value in one line and prepending it to the next line:

          (00:05:[^\r\n]+[\r\n]+)

          Thanks so much!

          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