I migrated my notes from evernote to markdown files with yarle. unfortunately it created me a lot of folders seperatively for the attachments (although I set it up for one folder only). I moved all attachements to one folder, so the filepath to the attachments in the mardown files needs to be updated. I think regex would be right for this, but I don't have any knowledge about regex and would be really thankful for help.
Filepaths are as follows:![[./_attachmentsMove/Coordination_Patterns.resources/CoordinationPattern_Ipsi.MOV]]
All filepaths are identical ![[./_attachmentsMove/]]
up to this
The second folder varies e.g. Coordination_Patterns.resources/
.
I want to delete everything but the filename.extension itself e.g. ![[CoordinationPattern_Ipsi.MOV]]
.
An example of the other filepaths:
![[./_attachmentsMove/Jonglieren_(Hände).resources/07 Jonglieren.MOV]]
(second folder changes, filename changes, I also have .png and .mov).
I use MassReplaceIt (app for mac) which allows me to replace expressions in documents with regex. If someone has a solution using the terminal/commandline, I'll try this as well of course :)
CodePudding user response:
Try if this regexp suffices:
(?<=!\[\[)[^\]] /(?=[^\]/] ]])
Replace with empty string.
It should delete the part from the ![[
up to the last /
before the next ]]
.