Regular expressions are only used by the Scan Name/Text actions, all other actions like Change Name are only able to use the numbered results.
The Script with Input/Output action might be a good alternative, there are already scripts for lower and upper case (see ~/Library/Application Scripts/com.devon-technologies.think/Script Output/)
Firstly, your RE is borken, even in BBEdit.
Example: “MyFunnyTag” will be converted to “myFunnyTag”.
It’s a serious case of overengineering: If you want to lowercase a string, just do it:
(.*) => \l\1
Or is that the intended behavior, as in the title of your post? Whereas in the text, you say that you want to rename tags to “purely lowercase”, which is not quite the same as “initial lower case”.
DT uses Apple’s framework for REs. And lowercasing in the replace function is not really standard anyway. I think Perl can do that, but JavaScript (for example) can’t.
You can find out more about the flags supported by NSRegularExpression here:
though I don’t think that DT has implemented all or even any of them.
So, I’d suggest that you use a tiny script doing what you want, something like
The code is written in JavaScript/JXA, but I’m confident that the same result can be achieved with AppleScript. There’s an eye-watering example over at Apple’s:
that only works for ASCII characters. Oh, well, the good old times …
While I’ve gone with Cris’s suggestion for simplicity, I really appreciate the time you spent to give such a comprehensive answer – and when I’ve got a bit more free time, I shall look at it, and your other JXA posts in more details to understand more. Thank you again!
Yes – as I said, I was mainly interested in whether I could use the regex output (using \l and its variants) at all. The specific details of the casing could wait till I’d got the principle sorted, and for the time being, all lowercase will do fine.