• Login
Community
  • Login

clean http file

Scheduled Pinned Locked Moved General Discussion
8 Posts 2 Posters 441 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.
  • P
    pinuzzu99
    last edited by pinuzzu99 Mar 17, 2023, 8:27 AM Mar 17, 2023, 8:17 AM

    hi everybody, i’ve saved an html file and i make a new macro to clean this file and keep only https links
    this is the file after some step of my macro:
    (note: i have 6 space at beginning, before </div> tag)

          </div></td><td><a href="https://g918-0f6cd9050b3b/IMG_20200906.jpg" target="_blank" class="text-fs-6">IMG_20200906.jpg</a>
          </div></td><td><a href="https://s06.00f6-4b63-9901-a698c6718296/haras0004.jpg" target="_blank" class="text-fs-6">haras0004.jpg</a>
          </div></td><td><a href="https://s784e473fc-c0d0-4a19-8c62/carama.jpg" target="_blank" class="text-fs-6">carama.jpg</a>
          </div></td><td><a href="https://s86.ce02-45c8-8518-38eae69d7832/IMG_202007.jpg" target="_blank" class="text-fs-6">IMG_202007.jpg</a>
    

    i need to have this only:

    https://g918-0f6cd9050b3b/IMG_20200906.jpg
    https://s06.00f6-4b63-9901-a698c6718296/haras0004.jpg
    https://s784e473fc-c0d0-4a19-8c62/carama.jpg
    https://s86.ce02-45c8-8518-38eae69d7832/IMG_202007.jpg
    

    now my macro use this regex to clean first part:

    replace  (?-s).*href="
    

    and this regex to clean final part:

    replace (regex)    ".*
    

    but i have a better way to do this?
    maybe with only one command?
    Regards

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Mar 17, 2023, 8:41 AM Mar 17, 2023, 8:39 AM

      Hi, @pinuzzu99 and All,

      Easy ! just use, in your macro the following search/replace regexes, below :

      SEARCH (?-s)^.+?"(.+?)".+

      REPLACE $1 OR \1


      Note that I used lazy quantifiers ( +? ) in order to get the smallest range of characters before the first " char and before the last one, as well !

      Best Regards,

      guy038

      1 Reply Last reply Reply Quote 1
      • P
        pinuzzu99
        last edited by Mar 17, 2023, 1:19 PM

        wow. your code work like a charm!
        for me found right code like your is a big effort.
        thank you so much for your support!

        Regards

        1 Reply Last reply Reply Quote 1
        • P
          pinuzzu99
          last edited by Mar 17, 2023, 5:14 PM

          still another question: how to bookmark all lines between https: and .jpg ?

          https://xxxxxxxxxxxxxxxx.jpg
          
          1 Reply Last reply Reply Quote 0
          • G
            guy038
            last edited by guy038 Mar 18, 2023, 9:32 AM Mar 17, 2023, 10:34 PM

            Hello, @pinuzzu99 and All,

            I’m surprised that you have not found the solution by yourself !

            • If you want to bookmark the lines of your INPUT file, use the regex https.*?\.jpg

            BTW, this is a second solution to your initial problem : once that all the sections are marked with the Mark All button, simply use the Copy Marked Text button and paste the results in a new tab !

            • And, if you want to boomark the lines of your OUTPUT file, use the obvious regex (?-s)^.+

            BR

            guy038

            1 Reply Last reply Reply Quote 1
            • P
              pinuzzu99
              last edited by Mar 18, 2023, 8:22 AM

              thank you (again) for your reply.
              great and hopeful answer

              and sorry for this useless stuff, but how code use to put all your regex? from Replying toolbar i can see only “code” tag …

              1 Reply Last reply Reply Quote 1
              • G
                guy038
                last edited by guy038 Mar 18, 2023, 11:50 AM Mar 18, 2023, 10:16 AM

                Hi, @pinuzzu99 and All,

                When you click on a reply link, to elaborate an answer, simply click on the link COMPOSE ?, in order to get a summary of the main Markdown syntaxes !

                You may also look to the valuable Markdown tutorial !

                Note that my regex’s syntax is an In line code, which is displayed in red color on our site. You may emphasize this code with the italic or bold syntaxes , as I usually do !

                Best Regards,

                guy038

                1 Reply Last reply Reply Quote 1
                • P
                  pinuzzu99
                  last edited by Mar 18, 2023, 2:01 PM

                  and so thanks for your for your explanation !

                  All the best

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