Crop all alphanumeric characters after the first Parenthesis

A swapping-ground for Regular Expression syntax

Crop all alphanumeric characters after the first Parenthesis

Postby Non-Offensive Name » Thu Mar 28, 2019 8:20 pm

Hello All,

First, let me tell you how much I greatly appreciate the developer of this software making it easier for newbies to bulk rename files.

Secondly, I wanted to say that I have been searching for the answer to my question for some time, which has brought me to this forum's web pages. I can honestly say I have never seen such a respectful forum. Every response that I have read, has been very helpful, and never disrespectful to those who are beginners. Well done!

Now, on to my question. So I have a file name structure that looks like:

Have Now: Ford Motor (5.0 Liter)[Camshaft Lube] Teflon (Type 2)
I Want: Ford Motor

Everything after the first "(" I want to crop. In every circumstance it will be "Name of File" followed by "(".

This seem like it should be very simply to me, but I can't find anything showing how to crop after just 1 "(", everything I've found is for cropping when you have () or [].

Thanks in advance.
Non-Offensive Name
 
Posts: 2
Joined: Thu Mar 28, 2019 7:44 pm

Re: Crop all alphanumeric characters after the first Parenthesis

Postby therube » Thu Mar 28, 2019 8:41 pm

See what this does for you:


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


Note that that will work for:

s01e01 - (10-02-1959) Where Is Everybody.avi
s01e10 - (12-04-1959) Judgement Night.avi
->becomes
s01e01 -.avi
s01e10 -.avi

But it fails with:

Angela Hewitt - Beethoven, Piano Sonatas Vol. 1 (2006)

because ". 1 (2006)" is being treated as the file extension, rather then a file name that happens to have a (dot) in there. (And that will depend on whether you are setting the option to include or not, extensions, in your renaming.)


Likewise, with your, Ford Motor (5.0 Liter)[Camshaft Lube] Teflon (Type 2):

The filename is: "Ford Motor (5"
And the extension is: ".0 Liter)[Camshaft Lube] Teflon (Type 2)"

If none of your names have actual file extensions, you can set:
Renaming Options -> Ignore -> File Extensions
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Crop all alphanumeric characters after the first Parenthesis

Postby Non-Offensive Name » Thu Mar 28, 2019 8:55 pm

therube wrote:See what this does for you:


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


Note that that will work for:

s01e01 - (10-02-1959) Where Is Everybody.avi
s01e10 - (12-04-1959) Judgement Night.avi
->becomes
s01e01 -.avi
s01e10 -.avi

But it fails with:

Angela Hewitt - Beethoven, Piano Sonatas Vol. 1 (2006)

because ". 1 (2006)" is being treated as the file extension, rather then a file name that happens to have a (dot) in there. (And that will depend on whether you are setting the option to include or not, extensions, in your renaming.)


Likewise, with your, Ford Motor (5.0 Liter)[Camshaft Lube] Teflon (Type 2):

The filename is: "Ford Motor (5"
And the extension is: ".0 Liter)[Camshaft Lube] Teflon (Type 2)"

If none of your names have actual file extensions, you can set:
Renaming Options -> Ignore -> File Extensions



This absolutely worked like a champ. Thank you very much.
Non-Offensive Name
 
Posts: 2
Joined: Thu Mar 28, 2019 7:44 pm


Return to Regular Expressions