Remove text between 2 characters

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

Remove text between 2 characters

Postby sbree » Tue Aug 28, 2018 10:29 am

Hi,

I am trying my best to learn Regex but I still suck. I would appreciate if someone can assist me.

I have a file name:
3052503155104.Bourjois_FDTAirMat_01_1.png

I would like to keep everything before the first . and erase everything until the last _
so the desired output would be 3052503155104_1.png
I want to remove the . as well but keep the _

so
3052503155104.Bourjois_FDTAirMat_01_1.png
3052503155104.Bourjois_FDTAirMat_01_2.png
3052503155104.Bourjois_FDTAirMat_01_3.png

becomes
3052503155104_1.png
3052503155104_2.png
3052503155104_3.png

Would greatly appreciate your help.

P.S - I don't want to use the prevent duplicate feature as a workaround.
sbree
 
Posts: 4
Joined: Sun Aug 26, 2018 9:46 am

Re: Remove text between 2 characters

Postby Tolek12 » Tue Aug 28, 2018 3:37 pm

Use regex box in the gui
match:
Code: Select all
(^.*?)\.(.*?)(_\d$)

replace:
Code: Select all
\1\3

include ext should be unchecked.

If you have problems with regex just go to Regex101 and try things out : https://regex101.com/r/F4gaEE/2
Tolek12
 
Posts: 4
Joined: Sun Jul 16, 2017 10:18 pm

Re: Remove text between 2 characters

Postby therube » Tue Aug 28, 2018 4:25 pm

(Heh. Didn't realize it was answered. Anyhow, my take...)

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


Oh, & now looking at yours, I see I didn't even read what the OP was looking for correctly, so what I have above is wrong.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support