Hello, if I want to rename a file with a clipboard string which contains illegal characters [ : * ? " < > ], I can do this using "Rename Inline (F2)" and paste, and it will strip any of them out (Windows default behaviour), however if I use "Rename To {clip}", it causes an error. Please can you modify the "Rename To {clip}" function to do the same thing. I understand that slashes will create a folder tree and that's pretty cool.
I don't have enough brainpower left today, I may try tomorrow, but I think that perhaps, since rename from clipboard functionality is much like pasting into an inline rename, maybe you can try to replicate what Windows does and simply strip any illegal chatacters by default (or add a /switch) - they will never be accepted by the OS anyway.
That would stop people being able to paste wildcard and regular expressions into the Rename window, which would be quite a pain.
We already provide a way to make the clipboard text safe. What's wrong with substituting characters with similar ones rather than removing them entirely? What happens if all the characters are illegal and you end up with an empty filename? (It also makes clashes with another file less likely, although those are still possible of course.)
You could split the first RegExS into two separate ones, one like this and another one replacing with nothing (depending on the characters you want to remove vs. replace by something else).
I gave you my similar button code that has a dialog, you don't need to keep it if you don't want it :
@nodeselect
Rename PATTERN * TO "{=RegExS(Clip(), "[:<>/\\\|\?\*]", "")=}" IGNOREEXT
If you want to keep the ability to get subfolders with / in the clipboard, remove it from the regexp.
I did not try latest @lxp suggestion, but this should be pretty similar.