Copy first two words of filename to clipboard

Hi guys,

I'm looking for a command to copy the first two words of the selected file (or top most file if several are selected) to the clipboard. All filenames contain characters from a-z (no numbers).

When I say "two words", I actually means the first two blocks of text containing one character or more.

I don't know where to start on this one...

Thanks in advance

Blueroly

Try this:

Clipboard COPYNAMES=nopaths REGEXP "^(\w+)\W+(\w+)" "\1 \2"

Perfect. Thanks Leo.

Hi Leo, your code works fine but when I add the addition code shown below, the first part of the command is ignored. Can you explain where I am going wrong please?

Clipboard COPYNAMES=nopaths REGEXP "^(\w+)\W+(\w+)" "\1 \2"
Copy MOVE HERE CREATEFOLDER="{clip}"

Running the first line of code on a selected file and then running the second line separately works fine, but combining them doesn't.

{clip} is evaluated before any of the command is run, so changing the clipboard contents in the first line is too late.

You'll probably need to use some VBScript or similar to get what you want (and doing it that way will avoid trashing your clipboard contents when you run the command).

I suspected it was something to do with the {clip} command. No worries, I can manage with two hotkeys to run the separate commands. Thanks again.