Community
    • Login

    Search Syntax to get X + the next character

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    modesearch
    3 Posts 2 Posters 2.4k Views
    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
      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
        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
          Malte Mueller
          last edited by

          Yes, that works just fine. Thanks a lot ☺

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors