Given a list of profile image links in markdown with varying name lengths:
![[Last, First.jpg]]
![[Longerlast, Longerfirst.jpg]]
etc
How can I convert to the following using regex in NPP?
![[Last, First.jpg]]
::Last, First
![[Longerlast, Longerfirst.jpg]]
::Longerlast, Longerfirst
etc
I was able to isolate the first and last patterns through trial and error, but am running into a wall before a complete solution.
^!\[\[(.+?)\.jpg]]\K
\n::$1
. matches newline
Explanation:
^ # beginning of line
!\[\[ # literally ![[
(.+?) # group 1, 1 or more any character, not greedy
\.jpg]] # literally .jpg]]
\K # forget all we have seen until this position
Replacement:
\n # liebreak, you can use \r\n for Windows EOL
:: # ::
$1 # content of group 1 i.e. last, first
Screenshot (before):
Screenshot (after):