💾 Archived View for republic.circumlunar.space › users › johngodlee › posts › 2020-06-30-vim-html-md… captured on 2024-08-25 at 01:34:00. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-04)
-=-=-=-=-=-=-
DATE: 2020-06-30
AUTHOR: John L. Godlee
I was quite proud of myself for figuring this one out in only about 2 minutes, in Vim. Starting with an HTML img tag:
<img src="img/jetz_table.png" alt="Functional diversity measures" width="640">
And using this Vim regex:
s/<img src="\(.\{-}\)".*alt="\(.\{-}\)".*//g
To create this Markdown formatted image link:

This was my first proper outing using \{-} for non-greedy matching, used on the double quotes ". It also uses capture groups \(.{-}\) -> \1.