Search Syntax to get X + the next character

  • 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 :)

  • In the Replace dialog enter into Find what:


    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).

  • Yes, that works just fine. Thanks a lot ☺

Log in to reply