How to copy selected file name but remove 4 character from right

This is a Demo File Name (1)
This is a Demo File Name
How to create a button for copy the selected file name but remove the last 4 character.

The Clipboard command can apply a regex to change the filename it puts into the clipboard.

what is the regex code for remove last 4 character

After so many questions, it is time to learn how to do regex yourself.

1 Like

I am stack on copy and clipboard command

Which part are you having trouble with?

Clipboard COPYNAMES=nopaths REGEXP=("(.*)\\w{4}"))

not Working the regexp part

  • The regex has unbalanced brackets around it, and the outer brackets shouldn't be there at all.

  • The REGEX argument takes two strings: The regex pattern, and the replacement string. You're only giving the first of those and missing the second. See the example in the manual, or search the forum for "clipboard regex" for many more examples.

Can you give the link from the manual please

Select "Opus Manual" at the top right of this thread and select "Regex Syntax" in the dropdown:

Go to the manual page for the Clipboard command. Then find the part where it explains the REGEX argument. There is an example there.

There are also lots of examples here on the forum if you search for "clipboard regex".

OK Finally I have Solved the puzzle.
Thank you so much dear Chuck and Leo for your Help.

Clipboard COPYNAMES=nopaths REGEXP "(.*).\(\d+\)" "\1\2"
Set SOURCE=Toggle 

If any one want to use this button Here is the
If you have a file with THIS_IS_DEMO_NAME (01) in your (left) file display
and you want to create a Folder in your other (right) file display with the name THIS_IS_DEMO_NAME
Then Open that folder THIS_IS_DEMO_NAME
In This case you can use this button.
This button just copy the selected file name to the clipboard
then remove the number part and the space from the right of the file name (01)
then Change the focus of your file display from left to right file display
then create a folder with the name from clipboard THIS_IS_DEMO_NAME
then open the THIS_IS_DEMO_NAME
Thank you
If any one can do the same things in more simple way then please comment below.