Last time, I presented a case in which I wanted to take a list of files complete with file path, and extract just the file name without the extension.
So basically, I get a list of file names that come back like this:
hugo-files/data/links/cars.json hugo-files/data/links/podcasts.json hugo-files/data/links/language.json hugo-files/data/links/apps.json hugo-files/data/links/security.json hugo-files/data/links/linux.json hugo-files/data/links/programming.json hugo-files/data/links/apple.json
And I want to turn it into the following list instead, by getting rid of the directory paths and the .json file extensions:
cars podcasts language apps security linux programming apple
I do this in my shortcut using a Match Text action with the following regular expression:
It looks mind-bogglingly weird if you’re not used to regular expressions, and certainly someone skilled with them could probably perform the same task with a much more elegant version, but this does the job for me, and it’s really quite simple. Basically, it looks for strings that match the following: …