Removing contents inside parentheses....tweak

I've been using this to remove stuff inside which have mostly been at the end of the title field:

\s((.*))

Works great, but now I have a bunch of files where the parentheses and are at the beginning of the title similar to:

(WEGWE) MYMP3FILE ROCKS

I want to remove the parentheses and the single space in between.

I've tried:

^ \s((.*))

\s^((.*))

But neither of these two to start at the beginning of the line does not work which I would expect that it would since it's being told to start at the start of line instead of defaulting at the end of line.

Can someone help me to fix this properly?

Thanks

Chris

I'm kind of a regexp newb, but shouldn't the \s be at the end instead of the beginning?

^((.*))\s

Action type: Replace with regular expression
Field: _TAG (Use whatever you want here, as you have not stated in your post)
Regular expression: (\w+)\s|\s(\w+)$
Replace matches with:

[ ] case-sensitive comparison

This makes in one reg exp:
(WE11GWE) MYMP3FILE (WEGWE) ROCKS (WEGWE)
TO
MYMP3FILE ROCKS

MYMP3FILE (WEGWE) ROCKS (WEGWE)
TO
MYMP3FILE ROCKS

MYMP3FILE (WEGWE) ROCKS
TO
MYMP3FILE ROCKS

MYMP3FILE ROCKS (WEGWE)
TO
MYMP3FILE ROCKS

Explanation:
( matches '('
\w+ matches single word character 'letters digits etc' the + adds find this an unlimited no. of times.
) matches ')'
\s matches one whitespace character.
| OR match reg exp no.2 also.
\s matches one whitespace character.
( matches '('
\w+ matches single word character 'letters digits etc' the + adds find this an unlimited no. of times.
) matches ')'
$ asserts position of text string at end of line.

Hope this helps :]

Thank you both, this does solve my issue and I have better understanding....TY!

Chris

Hi,

I have just tried this expression:

"[quote="stevehero, post:3, topic:12741"]
Action type: Replace with regular expression
Field: _TAG (Use whatever you want here, as you have not stated in your post)
Regular expression: (\w+)\s|\s(\w+)$
Replace matches with:
[/quote]

However, when used on the %albumartistsort% field where I have the following text:

Alexander Ivashkin (cello); Cristina Ortiz (piano); David Oistrakh (violin)

It returns the following result:

(cello); (piano); (violin)

This is the opposite of what I would like. i.e. just the names retained, but parentheses and content deleted.

Can anyone please suggest a solution to achieve the removal of ALL instances of parenthetical content?

1 Like

Try an action of the type "Replace with regular expression" für ALBUMARTISTSORT
Search string: \s\(\w+\)
Replace string:
(leave empty)

1 Like

Thanks very much for your quick response, but unfortunately when I repeat the action you suggest I have no change at all to the field contents.

Before: Alexander Ivashkin (cello); Cristina Ortiz (piano); David Oistrakh (violin)

Action - Field: ALBUMARTISTSORT
Regular expression: `\s(\w+)
Replace matches with:

After: Alexander Ivashkin (cello); Cristina Ortiz (piano); David Oistrakh (violin)

you are right.
I forgot the closing accent -grave and the #@!"§$& formatter left out the important brackets.
the correct search string would be:
\s\(\w+\)

Brilliant! It worked just as I wanted. Thanks again

That regexp may lead to unwanted whitespace characters.

Here's another way to skin a cat. PRESS THIS TEST BUTTON

\s*\([^\)]+?\)\s*

Thank you for this. It works a treat and keeps it tidy.

Holy thread resurrection......LOL.

:wink: