Community
    • Login

    Run multiple search and replace - one after another

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    search miltiple
    5 Posts 3 Posters 121 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.
    • Ramses505R
      Ramses505
      last edited by

      I have a few search and replace combinations that I use frequently that mostly work - but I usually need to run maybe 3 of them one after another - kind of like this;
      1.
      To remove incorrect CRLF – start with the following
      Remove CRLF for sentences ending in lower case letter;
      Search ([a-z])\R
      Replace \1
      2.
      Remove CRLF for sentences ending in hyphen;
      Search -\R
      Replace NOTHING
      3.
      ! Remove COMMA (,) for sentences ending in COMMA (,);
      Remove CRLF (,) for sentences ending in COMMA (,);

      Search ,\R
      Replace NOTHING

      Is there a way I can run these with a script or something like that ? As you might see I need to keep a list of them all which I then have to copy and paste into the editor one after another and mistakes often happen :-(

      Any help would be much appreciated and I am anxious to learn.

      Thanks

      Terry RT 1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R @Ramses505
        last edited by

        @Tobias-Ray

        Yes, in a word “Macro”.

        It is just the saving of the keystrokes and regular expressions in whatever function (Find, Replace). Once saved and given a name and possibly a shortcut mapping you can run it anytime you wish.

        Best to read the online manual, it explains it there.

        Terry

        1 Reply Last reply Reply Quote 3
        • Mark OlsonM
          Mark Olson
          last edited by

          @Ramses505

          TerryR omitted a link to the documentation. Here it is.

          Ramses505R 1 Reply Last reply Reply Quote 2
          • Ramses505R
            Ramses505 @Mark Olson
            last edited by

            Thank you Terry and Mark. @Mark-Olson
            Out of interest - can I run some sort of python script that would do this as well ?

            Thanks for taking the time to read and answer, appreciated.

            Mark OlsonM 1 Reply Last reply Reply Quote 0
            • Mark OlsonM
              Mark Olson @Ramses505
              last edited by Mark Olson

              @Ramses505 said in Run multiple search and replace - one after another:

              Out of interest - can I run some sort of python script that would do this as well ?

              Yes. If you already know Python, the PythonScript plugin can let you automate Notepad++ with Python.

              If you don’t know Python, this forum is not the place to discuss how to learn Python. There are countless tutorials on the internet for that purpose. I’ll just mention the re library and leave it at that.

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