gyng/save-in

Regex to remove 'http://' and 'https://' from final filenames?

Opened this issue · 1 comments

I have a rule that renames files like this:

// website.com* rule
pagedomain: website.com*
into: :pageurl:_:pagetitle:_:filename:

But files are saved with https___. How can I exclude this part?

I tried regex [A-Za-z]+:// and [A-Za-z]+_+ that would select the part to exclude from final :pageurl: but I can't find an option to omit certain text in this extension.

gyng commented

capture can be used here:

pagedomain: website.com*
sourceurl: https://(.*)
capture: sourceurl
into: :$1:_:pagetitle:_:filename:

https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/Harry_S._Truman_-_NARA_-_530677_crop.jpg/206px-Harry_S._Truman_-_NARA_-_530677_crop.jpg
becomes
206px-Harry_S._Truman_-_NARA_-_530677_crop.jpg_Wikipedia, the free encyclopedia_206px-Harry_S._Truman_-_NARA_-_530677_crop.jpg in this case. Although the slashes might mess things up. In that scenario there isn't a solution for that.