Page 1 of 1

Help removing everything inside () brackets

Posted: 25 Apr 2018, 04:46
by Ccooluke
Like the title says. I’m trying to remove everything inside the brackets only.
Example:

Code: Select all

Hal Jordan & the Green Lantern Corps 001 (2016) (2 covers) (digital) (Minutemen-Slayer)
All I want the file to say is:

Code: Select all

Hal Jordan & the Green Lantern Corps 001
Now, I had the right code as a preset, it worked great. Java updated and all my presets are gone and I don’t remember the code and can’t figure it out.
I think it was something along the lines of:

Code: Select all

{n.before(‘ [0-9]’)}
But that only returns “Hal Jordan and the Green Lantern Corps” without the issue number. Any help would be great thanks.

Re: Help removing everything inside () brackets

Posted: 25 Apr 2018, 05:12
by rednoah
This regular expression will do the job:

Code: Select all

/\(.*\)/

Code: Select all

fn.replaceAll(/\(.*\)/, '')
:arrow: viewtopic.php?f=3&t=2072

Re: Help removing everything inside () brackets

Posted: 27 Apr 2018, 08:26
by Ccooluke
rednoah wrote: 25 Apr 2018, 05:12 This regular expression will do the job:

Code: Select all

/\(.*\)/

Code: Select all

fn.replaceAll(/\(.*\)/, '')
:arrow: viewtopic.php?f=3&t=2072
This is exactly what I was looking for, thank you. And I figured out that other piece of code I had, it completes what I ultimately use it for:

Code: Select all

~comics path~/{n.before(' [0-9]')}/{fn.replaceAll(/\(.*\)/, '')}
which renames the comic and auto sorts it into a folder containing it's name (Without the issue number).

perfect! I've saved this all in a text file incase filebot wipes out my presets again, lol.

Re: Help removing everything inside () brackets

Posted: 26 Mar 2024, 06:54
by rednoah
e.g. remove (...) patterns from the file name:

Format: Select all

{ fn.removeAll(/\(.+?\)/) }
e.g. remove [...] patterns from the file name:

Format: Select all

{ fn.removeAll(/\[.+?\]/) }
:arrow: Replace Characters, Words or Patterns