Community
    • Login

    Remove URL from lines but keeps the text

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 3 Posters 1.5k 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.
    • Thiago MoraisT
      Thiago Morais
      last edited by

      Hi Folks

      My company antispam system insert a URL in each attach files received by email and cause a discomfort to read the content. How can I solve my discomfort to removing the URL inserted by the antispam, but keeping the rest of the text?

      See below some lines of the issue.

       Network          Next Hop            Metric LocPrf Weight Path
      

      *> https://protect-eu.mimecast.com/s/tIwRCoY3kuB8G8zGs2IZH5?domain=1.1.0.0 https://protect-eu.mimecast.com/s/-sM8CO7mzS0wXwKXukLavD3?domain=200.182.239.29 0 4230 65450 ?
      *> https://protect-eu.mimecast.com/s/n6lRC48APFm6W61WSOkghP9?domain=10.55.0.0 https://protect-eu.mimecast.com/s/-sM8CO7mzS0wXwKXukLavD3?domain=200.182.239.29 0 4230 65450 63814 65500 ?
      *> https://protect-eu.mimecast.com/s/6ynJCqjgmTzRrR5rFYtemb?domain=10.55.3.176 https://protect-eu.mimecast.com/s/-sM8CO7mzS0wXwKXukLavD3?domain=200.182.239.29 0 4230 65450 ?
      *> https://protect-eu.mimecast.com/s/wjI3Cr0jns16j6vjf67Yt7?domain=10.55.3.208 https://protect-eu.mimecast.com/s/-sM8CO7mzS0wXwKXukLavD3?domain=200.182.239.29 0 4230 65450 ?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Thiago Morais
        last edited by

        @Thiago-Morais ,

        To get rid of http/https URLs in any block of text,
        FIND = https?://\S*
        REPLACE = blank/empty
        SEARCH MODE = regular expression

        Thiago MoraisT 1 Reply Last reply Reply Quote 1
        • Thiago MoraisT
          Thiago Morais @PeterJones
          last edited by

          @PeterJones said in Remove URL from lines but keeps the text:

          https?://\S*

          Your suggest worked, but I need to fix a little detail on the expression.

          I need to remove the URL until the equal sign and let rest of the text, how can I do that?

          1 Reply Last reply Reply Quote 0
          • guy038G
            guy038
            last edited by guy038

            Heelo, @thiago-morais,

            Two questions :

            • Are all the URL lines in a single line or may be split into several lines ?

            • Your URL lines contain two = signs… What is the exact part to delete ? From beginning to the first or to the second = ?

            Best Regards,

            guy038

            Thiago MoraisT 1 Reply Last reply Reply Quote 0
            • Thiago MoraisT
              Thiago Morais @guy038
              last edited by

              @guy038

              Hello @guy038

              As you can see in the line, there are two URL, I need to remove the both and keep the rest of the text after the equal sign.

              Current:
              *> https://protect-eu.mimecast.com/s/tIwRCoY3kuB8G8zGs2IZH5?domain=1.1.0.0 https://protect-eu.mimecast.com/s/-sM8CO7mzS0wXwKXukLavD3?domain=200.182.239.29 0 4230 65450 ?

              How should be:
              *> 1.1.0.0 200.182.239.29 0 4230 65450 ?

              1 Reply Last reply Reply Quote 0
              • guy038G
                guy038
                last edited by guy038

                Hi, @@thiago-morais, @peterjones and All,

                Then, two regex solutions are possible :

                • If each URL line belong to a single line :

                  • SEARCH (?-s)https?://.+?=

                  • REPLACE Leave EMPTY

                • If some URL line(s) may be split into several ones :

                  • SEARCH https?://\S+?=

                  • REPLACE Leave EMPTY

                BR

                guy038

                Thiago MoraisT 1 Reply Last reply Reply Quote 2
                • Thiago MoraisT
                  Thiago Morais @guy038
                  last edited by

                  @guy038 said in Remove URL from lines but keeps the text:

                  (?-s)https?://.+?=

                  It’s worked
                  Thanks @guy038

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