• Login
Community
  • Login

Remove URL from lines but keeps the text

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 1.6k 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.
  • T
    Thiago Morais
    last edited by Jul 24, 2022, 3:43 PM

    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 ?

    P 1 Reply Last reply Jul 24, 2022, 4:45 PM Reply Quote 0
    • P
      PeterJones @Thiago Morais
      last edited by Jul 24, 2022, 4:45 PM

      @Thiago-Morais ,

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

      T 1 Reply Last reply Jul 24, 2022, 6:17 PM Reply Quote 1
      • T
        Thiago Morais @PeterJones
        last edited by Jul 24, 2022, 6:17 PM

        @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
        • G
          guy038
          last edited by guy038 Jul 24, 2022, 6:39 PM Jul 24, 2022, 6:36 PM

          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

          T 1 Reply Last reply Jul 24, 2022, 6:39 PM Reply Quote 0
          • T
            Thiago Morais @guy038
            last edited by Jul 24, 2022, 6:39 PM

            @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
            • G
              guy038
              last edited by guy038 Jul 24, 2022, 6:51 PM Jul 24, 2022, 6:49 PM

              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

              T 1 Reply Last reply Jul 24, 2022, 6:51 PM Reply Quote 2
              • T
                Thiago Morais @guy038
                last edited by Jul 24, 2022, 6:51 PM

                @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
                1 out of 7
                • First post
                  1/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors