Community
    • Login

    Stop Macro when find fails

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 508 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.
    • Vance NeffV Offline
      Vance Neff
      last edited by

      This was asked under General topics, but no response.
      I have a simple Macro that finds a term and deleted the line containing that term.
      But, after the last instance of that term was found, the Macro then proceeds to delete the remaining lines until it reaches the end of the file.

      How to stop the Macro when it no longer can find the search term?

      Neil SchipperN 1 Reply Last reply Reply Quote 0
      • Neil SchipperN Offline
        Neil Schipper @Vance Neff
        last edited by

        @Vance-Neff I’ve also had some surprising behavior when deleting or moving lines in macros.

        I suggest you abandon this approach, and instead, use a regex F&R to match a complete line containing the term, something like:

        ^.*?YOUR_TERM.*?$

        and then, make sure the Replace with field is properly empty (no spaces).

        Use Replace a few times to satisfy yourself replacements are being done as expected, then Replace All to act on the whole file.

        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