Clipboard COPYNAMES - Capturing with regex

I am trying to use the Clipboard COPYNAMES FILE REGEXP internal command to capture part of filenames but also have a problem capturing/comsuming spaces in the filename.
The filename is effectvely the input to the regular expression engine in this context.
For my tests:
Input Filename is as below:

One B6395 Three.PNG

The command formats for the 3 test are:

Clipboard COPYNAMES FILE REGEXP (B\d{4}) "YYYY \1 XXX"
Clipboard COPYNAMES FILE REGEXP "(One) (B\d{4}) (Three)" \1=\2=\3
Clipboard COPYNAMES FILE REGEXP (One) (B\d{4}) (Three) \1=\2=\3

Sapces are shown in orange background in the screenshot:

"Gratitude is good for you" (Just made that up so it might be mine :slight_smile: )

Any parameter containing spaces or = signs needs to be placed in quotes, or the arguments won't be parsed correctly.

(This is true for commands in general, and not specific to the Clipboard command or REGEX argument. The one exception is where a command takes a "raw" argument, where everything after that argument on the command line is fed to it.)

You also have a FILE argument on each line which isn't doing anything and should be removed.

Clipboard COPYNAMES REGEXP "(One) (B\d{4}) (Three)" "\1=\2=\3"
1 Like