I have used curl to grab a website's code and put it in a text file. I'd like to delete all text that isn't a link! Lucky for me, all links are inside quotes, so I just need to delete all lines without https://
in them, which I have done using :g!/https:\/\//d
. Now I need to delete everything to the left and right of the quotes.
Here is my dilemma:
LINE 1: RetailShop.URLs.getProductComponents = "https://example.com?emptyparam="; // random code
LINE 2: random code action="https://example.com" name="morerandomcode"
If I start by intending to delete everything to the left of the quotes, I would use something like this :%s/^.*"//
but if you try it yourself, it wants to delete everything to the left of the second quote on line 1. That would delete my whole link. Let's say I use a space, :%s/^.* "//
(after the * and before the "), then it would work on line 1, but not on line 2. Then when I do line 2 with :%s/^.*="//
it will delete my link in line 1 because of how the link ends.
I don't want to complicate this too much. Explicitly, I need a command that deletes the FIRST quote in every line regardless of what characters come before it.