Crop after a specific work BUT keep a specific part

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Crop after a specific work BUT keep a specific part

Postby gouisedeau » Thu Feb 23, 2023 4:51 pm

Hi there,

Although I've tried to understand Regex logic in BRU volume II, I'm overwhelmed by the thing..

I'm after something that look quite simple, but can't acheived it with basic BRU basic functions. Need to go Throught RegEx.

What I'm after :

Crop everything that come after a specifics words (NoteE or NoteP) BUT keep the following caracters (_ok) if the appear in the string.

List example :
A3_ARC-2005_H21_NoteE_BeatriceTellier_13115_ok.pdf
A3_ARC-2005_H21_NoteE_ouelletvincent_13115.pdf
A3_ARC-2005_H21_NoteE_fillionMichaël_13115_ok.pdf
A3_ARC-2005_H21_NoteP_dupitonDinah_13117_ok.pdf
A3_ARC-2005_H21_NoteP_MarceauRaphaelle_13117.pdf
...

should be:
A3_ARC-2005_H21_NoteE_ok.pdf
A3_ARC-2005_H21_NoteE.pdf
A3_ARC-2005_H21_NoteE_ok_1.pdf
A3_ARC-2005_H21_NoteP_ok.pdf
A3_ARC-2005_H21_NoteP.pdf
...

Kindly,
-CC
gouisedeau
 
Posts: 2
Joined: Thu Feb 23, 2023 4:40 pm

Crop after specific word(s) but keep specific ends

Postby Luuk » Fri Feb 24, 2023 2:06 am

Greetings gouisedeau, first to verify a checkmark inside for the menu... "Renaming Options, Prevent Duplicates".
So then Regex(1) needs a checkmark inside for "v2", with a "Match" and "Replace" looking something like...
(.+Note[EP])_.*?(_ok)?$
\1\2

The [EP] part is saying that there should be either one "E" or one "P" just after the "Note" part.
But can also use something like [EPKL] to include more letters, for words like "NoteK" or NoteL.
Or could also just use [A-Z] to include any uppercase english letter just after the "Note" part.

The (_ok)?$ part is just saying either 0-or-1 (text-strings like "_ok") at the very end
If only wanting to remove text ending with "_" and "5-digits", change _.*? ====> _.*_\d{5}

If only wanting to conduct the .pdf-files, can also type a Filters(12) "Mask" like... *.pdf
Then clicking the blue-arrows to the right, will present only the .pdf files for renaming.
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Crop after a specific work BUT keep a specific part

Postby gouisedeau » Fri Feb 24, 2023 8:58 pm

Luuk, That's exactly it! Thank for the explanation also, your answer is more then complete!

Regards,
-CC
gouisedeau
 
Posts: 2
Joined: Thu Feb 23, 2023 4:40 pm


Return to BRU Support