How to add underscore to filename

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

How to add underscore to filename

Postby kizer8 » Fri Aug 28, 2020 1:29 pm

Hi,

Does anyone know how to add an underscore (_) to a randomly named filename before the 1st occurrence of a number? It could be any text characters or any numbers, I want to add an underscore in between the 1st occurrence of a number.

For example:

test12425.txt
junk4234.txt
help67463.txt
kizer8
 
Posts: 6
Joined: Fri Aug 28, 2020 1:24 pm

Re: How to add underscore to filename

Postby therube » Fri Aug 28, 2020 4:07 pm

1:RegEx
Code: Select all
Match:  ([^\d]+)(\d)(.*)
Replace:  \1_\2\3

Match 1 or more not-digits
Match a digit
Match everything else

Stick an, _, between the not-digits & the (first) digit.
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to add underscore to filename

Postby kizer8 » Fri Aug 28, 2020 4:30 pm

This is awesome thank you very much.
kizer8
 
Posts: 6
Joined: Fri Aug 28, 2020 1:24 pm


Return to BRU Support