GP SoftwareTwitter
Opus FAQsManualCommandsObjects

How to add a button with a regular expression rename?


#1

hello there

i have a regular expression which i use pretty often and i want to add it to a menu i have made that has standard rename buttons.

how do i do this ?

old name - ()(.)S(\d\d)e(\d\d).(.[^.]+)

new name - \1\2- Series \3 - Episode \4\5

thank you


#2

ethereal, first off, do you know how to add a menu item?

You have to enter customize mode, then you can right-click on menu items and select things such as "Insert New / New Button"

How do you enter customize mode? In my view the easiest is to enable this preference: in Preferences, type "customize" in the search box, then check the box that says "Alt-click to edit toolbar buttons".

After that, any time you alt-click a toolbar button or menu item or an empty space on a toolbar, you enter customize mode. Then you can right-click inside menus or on the toolbar to add buttons.

In your new button, to make a regex renamer, this is the syntax you paste in the function box

Rename PATTERN="your_search_regex" TO="your_replace_expression " FINDREP @nodeselect


#3

I'd like to suggest your first make a Rename dialog Preset, and from that use your button to call the Preset. That way, you don't have to ever change the button if you wand to modify the Rename preset, and can use it directly from the Rename dialog too.

Just use the PRESET keyword in the RENAME comment instead of the PATTERN and TO keywords. Supply the preset name to the PRESET keyword. The Rename section in help describes the syntax.


#4

thanks for replying dudes/dudesses

i tried playful first and nothing happened at all.

MrC - i already had a preset called TV Series Rename and made a button - Rename PRESET="TV Series Rename"

this worked - thanks a lot. i am now going to see if i can stack presets - i.e. RENAME with TV Series Rename then RENAME with TitleCase from the same button.


#5

You might have a look at my Dynamic Renamer. With it, you can combine a sequence of transformations, which of course you can store as a single preset. It supports various case transformations (-c) and can do your RE replacement (-/).

So in your case, I think the transformation (the New name) would be something like:

-/S(\d{2})e(\d{2})/Series $1 - Episode $2/ -ct


#6

thanks a lot i'll give it a go


#7

i had partial success - names with spaces was okay but i had problems with names with . i tried to remove them with -A but i don't have a clue what i am doing. is it possible to remove the . and replace with a space?

lily.allen.from.riches.to.rags.s01e02.ws.pdtv.xvid-ftp.avi

thanks - nice preset


#8

Are you using Dynamic Renamer, or the dopur RE?


#9

i was using dynamic renamer 1.10

-/S(\d{2})e(\d{2})/Series $1 - Episode $2/ -ct

it worked for (Lily Allen - From Riches to Rags S01E01.avi) there are spaces

but because (lily.allen.from.riches.to.rags.- Series 01 - Episode 02.avi) has some . instead of spaces it thought lily.allen.from.riches.to.rags.- was one word and capitalized the first l

can i use dynamic renamer to replace . with spaces ?


#10

Sure. Add

-r/./ /g

as the first transformation.