Page 1 of 1

Remove all parentheses except one

PostPosted: Sun Jun 25, 2017 11:16 pm
by firewater
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.

Re: Remove all parentheses except one

PostPosted: Tue Jun 27, 2017 6:50 am
by Emerkamp
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.

Re: Remove all parentheses except one

PostPosted: Sat Jul 01, 2017 4:59 am
by firewater
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.

Re: Remove all parentheses except one

PostPosted: Sat Jul 01, 2017 3:09 pm
by Emerkamp
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.

Re: Remove all parentheses except one

PostPosted: Fri Jul 07, 2017 5:53 am
by firewater
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!!