Community
    • Login

    Search Syntax to get X + the next character

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    modesearch
    3 Posts 2 Posters 2.7k 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.
    • Malte MuellerM Offline
      Malte Mueller
      last edited by

      Hello,
      I’m trying to find out how to Find & Replace a certain selection and take the next following character and include that into the selection so that I can replace it all by blank (delete).
      The practical example is:
      I have a log of about 50 messages, all of them start with a timestamp which is 15:2x. The log has captured an event that lasted for 9 minutes so I have 15:21, 15:22, 15:23 and so on. I would like to remove that prefix and find “15:2” + “x”, X being the next following character which in my case is 1-9. Tried extended mode with [1-9] but not sure if I’m doing it right.

      Appreciate the help :)

      1 Reply Last reply Reply Quote 0
      • Jim DaileyJ Offline
        Jim Dailey
        last edited by

        In the Replace dialog enter into Find what:

        ^15:2.
        

        and in Replace with enter nothing at all (make sure there is nothing in this box).

        Select Regular expression as the Search mode.

        This will delete “15:2” and the next character of every line (or selected line, depending on what you want to do), as long as the “15:2” is the very first thing on the line (the “^” in the Find what box means at the very beginning of the line).

        1 Reply Last reply Reply Quote 1
        • Malte MuellerM Offline
          Malte Mueller
          last edited by

          Yes, that works just fine. Thanks a lot ☺

          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