• Login
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.
  • M
    Malte Mueller
    last edited by Feb 12, 2016, 12:47 PM

    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
    • J
      Jim Dailey
      last edited by Feb 12, 2016, 1:24 PM

      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
      • M
        Malte Mueller
        last edited by Feb 12, 2016, 4:40 PM

        Yes, that works just fine. Thanks a lot ☺

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