Keeping urls and deleting rest of the stuff from copied sourcecode.
-
Hey,
I have source code of webpage, I only want to keep all links matching
https://d1a0n9gptf7ayu.cloudfront.net/photos/*.jpg links and delete rest of the code and save file.
How i can do that? -
@R-k said in Keeping urls and deleting rest of the stuff from copied sourcecode.:
depends, what exactly you want to achieve.
Do you want to delete ANY text except these links?
Or do you want to delete all lines having not the links? -
every thing is mixed up, its a 3000 line source code,
<li class=“photo-container” id=“thumb-29” data-index=“29” data-album-photo-id=“11730949”>
<a href=“https://d1a0n9gptf7ayu.cloudfront.net/photos/cda5bc6dcb6823c052a593959d5621.jpg”> -
I’ll give it a try in German as your avatar is Sebastian Vettel :-)
Soll jeglicher Text, außer den Links, gelöscht werden oder
sollen nur die Zeilen, welche nicht die Links enthalten gelöscht werden?Should any text, except for the links, be deleted or
should only the lines that do not contain the links be deleted? -
All text, except for the links, be deleted.
thats what i want.
-
OK, two step process
Open find dialog and select Mark tab.
Use this in find what:(.*)(https://d1a0n9gptf7ayu.cloudfront.net/photos/.*\.jpg)(.*)
Check bookmark line and press Mark All
Keep the dialog open but go to Search->Bookmark->Remove Unmarked Lines
Then select Replace tab and add this to replace with:$2
and press Reaplce All -
It is sometimes difficult to keep certain text by trying to match the remaining text, usually because the remaining text is hard to match because it may not be as patterned as the “to keep” text.
@guy038 discusses a technique to do this kind of text retention in this thread. Probably could be adapted to work well here.