Remove all parentheses except one

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Remove all parentheses except one

Postby firewater » Sun Jun 25, 2017 11:16 pm

Hello! I have files named with conventions like

"Rune Worth Kokui No Kikoushi (T&E Soft)(Disk 1)(Program)"

and I'd like to remove all of the parenthesis, except for "(Disk 1)", "(Disk 2)", and so on. I've used RegEx with

Code: Select all
(.+) \(.+
\1


to remove all parentheses in other ocassions, but I don't know how to do this one.
firewater
 
Posts: 8
Joined: Fri Jun 23, 2017 4:59 pm

Re: Remove all parentheses except one

Postby Emerkamp » Tue Jun 27, 2017 6:50 am

Hi,

Here's what I got for your example given above.

Code: Select all
Match:
(.*) \((.*)\)\((.*)\)\((.*)\)
Replace:
\1 \2(\3)\4


Kinda ugly, but it works if all patterns are the same as your example. You could also use box (3) and put a definer between )(.
So regex can find and break it up easier.
Emerkamp
 
Posts: 88
Joined: Sat Aug 23, 2014 2:35 pm

Re: Remove all parentheses except one

Postby firewater » Sat Jul 01, 2017 4:59 am

Oh boy... thank you very much - it works perfectly, except I didn't explain myself clearly. My goal is that all contained within those parenthesis is removed, rather than just the parenthesis haha... thanks again and sorry for the inconvenience.
firewater
 
Posts: 8
Joined: Fri Jun 23, 2017 4:59 pm

Re: Remove all parentheses except one

Postby Emerkamp » Sat Jul 01, 2017 3:09 pm

Hi,

The above code should have your files names broke down enough to do that.
Just use,

Match:
(.*) \((.*)\)\((.*)\)\((.*)\)
Replace:
\1
instead of the whole replace line.

If this isn't what you meant then please give us 2 or 3 examples, before and after to go by.
Emerkamp
 
Posts: 88
Joined: Sat Aug 23, 2014 2:35 pm

Re: Remove all parentheses except one

Postby firewater » Fri Jul 07, 2017 5:53 am

That's not quite what I wanted, but now that you've posted those two codes I understand how the "/1" part works and have modified it myself for the variety of cases I'm faced with. Thank you very much!!
firewater
 
Posts: 8
Joined: Fri Jun 23, 2017 4:59 pm


Return to BRU Support