Help removing everything inside () brackets

Any questions? Need some help?
Post Reply
Ccooluke
Posts: 4
Joined: 25 Apr 2018, 04:21

Help removing everything inside () brackets

Post 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.
User avatar
rednoah
The Source
Posts: 22984
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help removing everything inside () brackets

Post by rednoah »

This regular expression will do the job:

Code: Select all

/\(.*\)/

Code: Select all

fn.replaceAll(/\(.*\)/, '')
:arrow: viewtopic.php?f=3&t=2072
:idea: Please read the FAQ and How to Request Help.
Ccooluke
Posts: 4
Joined: 25 Apr 2018, 04:21

Re: Help removing everything inside () brackets

Post 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.
User avatar
rednoah
The Source
Posts: 22984
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help removing everything inside () brackets

Post 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
:idea: Please read the FAQ and How to Request Help.
Post Reply