Rename with regexp

I was wondering if anyone could help me with a button that I've been trying to make work.

I've gone through the forums and looked at many button scripts and have had some moderate success implementing the ideas presented but have reached a wall now.

I'd like to take a mixed up filename like

Song_Title (2006'ish).mp3

and change it to:

song title 2006 ish.mp3

I use programs like flexible renamer to get these sorts of things done but would like to do this right inside Opus.

the problem I'm finding is escaping the brackets and having multiple charcters to rename, the filename keeps getting truncated before or after the offending filename. I have a cursory understanding of how regex works and won't post what I've come up with at this point as it's just not working. any help in regards to this is appreciated and thanks for reading.

Hello Inkblob,

I have perhaps a temporary solution for you.
This regular expression runs multiple times until it converges.
The '#' character does this.
I've added a safety fuse just in case you may wish to 'experiment' some.
The integer 9 after the '#' character limits this to 9 iterations.
Removing this number could quite possibly freeze your computer if you modify anything here.

@NoDeselect Rename REGEXP PATTERN="(.*)(_|\(|\)|'| )(.*)(\.)(.*)#9" TO="\1 \3\4\5"

Unfortunately, this will create a space character in place of the last ')' character.
But, that's easy to get rid of with another rename or with perhaps just a little more thought on this.

Let us know what does and doesn't work.
We'll get it eventually !!!
One way or another .... :wink:

Regards,
Zippo

thanks Zippo =)

I was going about this the wrong way and this escapes the brackets great. I think one of the things I'm not grasping here is the TO= statements and how they work. It's not clear from what I've read so far, could you recommend a good resource site for this?

And it would be a matter of finding all instances of ' .ext' and turning that into '.ext' right?

This is already an invaluable application at work and home and just now starting to customize it with these sorts of buttons. I use a folder date/time stamp button daily to put client attachments in, and appreciate all the great ideas people have come up with here.

[quote="inkblob"]thanks Zippo =)

I was going about this the wrong way and this escapes the brackets great. I think one of the things I'm not grasping here is the TO= statements and how they work. It's not clear from what I've read so far, could you recommend a good resource site for this?[/quote]

I suspect that what is actually difficult for you is Regular Expression (sometimes abbreviate as RegExp). The TO option of the Rename command itself is fairly simple.

Here'a thread I participated in where I break down a RegExp example, it might help you see how it works. The Opus Help file and User Manual both have a section on Regular Expression. Wikipedia also has a fairly lengthy article on, and may list links to other sources.