I am having some trouble getting a macro using regex to work properly and I am stuck.
I would like the macro to take a tag (to be renamed) from Zotero and (1) convert - (note the sp) to / (no sp), (2) replace all remaining spaces with _ and (3) put all the text in lower case.
If I use it on the following tag 'Definition of- public interest' and I get 'definition_of-_public_interest'. So it achieves (2) and (3) but not (1) - even though I have (1) first.
And if you want to test this sort of thing, create an action like this, and look at the bottom of the action. The first action is the one that works, the second action is the one that doesn't work, for the same reason yours doesn't work, I believe.
Thanks @Airy! That worked. I had to keep with the regex in order to delete the space after the hypen but I removed the \ from before the dash and it is working correctly.
Careful! That's not what you are doing -- you're searching for "dash followed by any character". So a- b becomes a/b, as you want, but a-b becomes a/, which you probably don't.
"Normal" text replacement should work here, and it'll be more obvious in the KM actions if you use the %Space% token rather than a literal space.
Unless you're using the converted text elsewhere later there's no need to use a named clipboard -- it's ever-so slightly more efficient to do everything on the System clipboard.