Rename file to only the characters within the brackets

Advanced Renamer forum
#1 : 14/03-24 21:30
Nigel
Nigel
Posts: 8

File name currently Alice in Wonderland [SALE4Q].wbfs

I want it to be SALE4Q.wbfs

Thanks in advance. Love the product


14/03-24 21:30 - edited 14/03-24 21:58
#2 : 14/03-24 23:33
Delta Foxtrot
Delta Foxtrot
Posts: 105
Reply to #1:

Wow. I totally misread that question. My original answer stripped the stuff in the brackets out and left the rest.

I'll be right back.

Best,
DF


14/03-24 23:33 - edited 15/03-24 04:06
#3 : 15/03-24 04:13
Delta Foxtrot
Delta Foxtrot
Posts: 105
Reply to #2:

Ok, this works for some examples I made up.

REPLACE method:
Replace: ^([^\[]*)\[([^\]]*)\](.*)$
Replace with: $2
NOT case sensitive
Use regular expressions: YES
Apply to: NAME

Sorry about the mix-up earlier, I hope you didn't see it! :)

Best,
DF

PS. If anyone needs to remove a set of square brackets and enclosed text from some filenames, I have a script for that... that's what I get for watching The Office while playing on the computer. :)

Aw, heck. Here are the scripts:
-------------------
// Trim everything outside square brackets (plus brackets):
var theRest = item.name ;
var theTarget = theRest.match(/([^\[]*)\[.*\](.*)$/) ;
var theReturn = theTarget[1] + theTarget[2];
theReturn = theReturn.trim();
return theReturn ;
---------------
// Trim all but what's in square brackets:
var theRest = item.name ;
var theTarget = theRest.match(/([^\[]*)\[([^\]]+)\](.*)/) ;
var theReturn = theTarget[2] ;
theReturn = theReturn.trim() ;
return theReturn ;
-------------


15/03-24 04:13 - edited 15/03-24 04:46
#4 : 15/03-24 05:59
Styb
Styb
Posts: 80
Reply to #1:
Alternate way to accomplish your desired results:
- Replace method:
Replace:*[\]*
With: (empty)

Use regular expressions: No
Apply to: Name

-edited by DF



15/03-24 05:59 - edited 15/03-24 07:23
#5 : 15/03-24 06:41
Delta Foxtrot
Delta Foxtrot
Posts: 105
Reply to #4:

Hey Styb,

That just gets rid of the brackets, not the stuff outside the brackets. But this works:

*[\]*

Good catch, though. A lot simpler than regex or scripts. I always forget that stuff! :)

Best,
DF


15/03-24 06:41 - edited 15/03-24 06:43
#6 : 15/03-24 07:18
Styb
Styb
Posts: 80
Reply to #5:
Ooops !

I didn't understand the question. Thank you for the clarification.


15/03-24 07:18
#7 : 15/03-24 07:35
Delta Foxtrot
Delta Foxtrot
Posts: 105
Reply to #6:

No problem my friend. I didn't understand it the first time either!

And English is my ONLY language! :)


15/03-24 07:35
#8 : 15/03-24 13:13
Miguel
Miguel
Posts: 60
Reply to #5:


15/03-24 13:13 - edited 15/03-24 13:19