Page 1 of 1

Removing only text in a closed bracket

PostPosted: Tue Feb 28, 2017 1:44 pm
by ncawson
Hi everyone. LOVE the program!!! Has saved me many countless hours. Just a quick query... Looking to remove only the 'text' field in the bottom file layouts i.e. within brackets normal and square. Essentially just want to keep the 'filename' and 'date'. Please help or guide me to a place for further information. Nic.

eg:
FILENAME (1991)(text)

eg:
FILENAME (1983)(text - a to z)[text -a to z]

eg.
FILENAME (text - a to z) (1974)(text - a to z)[text -a to z]

Re: Removing only text in a closed bracket

PostPosted: Tue Feb 28, 2017 3:23 pm
by therube
If its always 4-digits in parenthesis, & only one set of them at that, you could do something like:

1:RegEx:
Code: Select all
Match:  (.*\(\d\d\d\d\))
Replace:  \1

(I didn't actually check the code, so very possible it is wrong ;-).)

Re: Removing only text in a closed bracket

PostPosted: Tue Feb 28, 2017 3:27 pm
by KenP
This should work.

RegEx (1)
Match: ^([^(|[]*).*(\(\d{4}\))
Replace: \1\2

Re: Removing only text in a closed bracket

PostPosted: Wed Mar 01, 2017 6:48 am
by ncawson
Thank you for your help guys!!! I have a lot of reading ahead of me to start understanding this stuff further... Much appreciated!

Just wanted to question why I can't simply input something like (a-z*) in replace (3) and leave the with field blank??? That is the brackets I want to delete only contain words and I could just specify the removal of all brackets with works ONLY? Not sure if its possible but the previous codes provided look amazingly elaborate for what I want to do...

Re: Removing only text in a closed bracket

PostPosted: Wed Mar 01, 2017 9:33 am
by KenP
ncawson wrote:Just wanted to question why I can't simply input something like (a-z*) in replace (3) and leave the with field blank??? That is the brackets I want to delete only contain words and I could just specify the removal of all brackets with works ONLY? Not sure if its possible but the previous codes provided look amazingly elaborate for what I want to do...

You can put the brackets/parenthesis with the text into Replace (3) to remove it, the problem is that it would only work if you specify the text and the brackets/parenthesis, i.e. (text to remove) but that won't remove anything slightly different such as [text to remove], the reason for using RegEx is that it can remove both the brackets and any text inside the brackets without specifying the exact text or brackets/parenthesis.

All you have to do is copy and paste the codes given into the RegEx boxes Match and Replace, to be honest I don't really see what's so elaborate about that :?

Anyway, good luck and if you need any further help just ask :wink:

Re: Removing only text in a closed bracket

PostPosted: Thu Mar 02, 2017 8:18 am
by ncawson
Thank you KenP. I agree that cutting and pasting is much more simplified process provided you have no issues with formulating the code every time I see fit? The pay will be non-existent and the hours terrible, but plentiful? Don't rush your decision.

Jokes aside... I have only just started using this program and like its capabilities even if my knowledge base is using the Replace (3) function repeatably - but has saved me days of work!!! Where can I get some top notch info about learning your magical code??? I understand the principles - just the execution is lacking.

Cheers. Ps. I did notice that when I put (*) in the Remove (5) field with Special set it only removed the brackets with numbers in them. Very slimier to what I wanted BUT not at all.

Nicholas.

I have another query if I may. I want to change [] to () with a typical set up like: FILENAME DATE. Note: the 'filename' could be made of many words and have numbers included i.e. a movie with date in square brackets [] - I'm over the square mathematical brackets. Thanks in advance.

Re: Removing only text in a closed bracket

PostPosted: Mon Mar 06, 2017 12:37 pm
by KenP
ncawson wrote:Thank you KenP. I agree that cutting and pasting is much more simplified process provided you have no issues with formulating the code every time I see fit? The pay will be non-existent and the hours terrible, but plentiful? Don't rush your decision.

:lol:

ncawson wrote:Jokes aside... I have only just started using this program and like its capabilities even if my knowledge base is using the Replace (3) function repeatably - but has saved me days of work!!! Where can I get some top notch info about learning your magical code??? I understand the principles - just the execution is lacking.

All the information you need is in the help file :wink:

ncawson wrote:I have another query if I may. I want to change [] to () with a typical set up like: FILENAME DATE. Note: the 'filename' could be made of many words and have numbers included i.e. a movie with date in square brackets [] - I'm over the square mathematical brackets. Thanks in advance.

You can change square brackets to parenthesis with "Character Translations".

Special (14)
Character Translations: Selected.

When you tick Character Translations a dialogue box will open, if not you can open it by clicking the icon where it says "Status: ".
In the dialogue box type what characters you want to change, type all the character translations on separate lines.

For instance:
(=[
)=]

When you finished with the character translations be sure to delete them from the dialogue box because the reset button will switch off Character Translations but it does not clear the dialogue box.

Hope this helps :wink:

Re: Removing only text in a closed bracket

PostPosted: Tue Mar 07, 2017 8:38 am
by ncawson
Awesome mate. Cheers. I'll start looking through the help files for guidance.

Your time is greatly appreciated!!!! Nic.