Remove from certain character to the end of file name

Bulk Rename Utility How-To's

Remove from certain character to the end of file name

Postby Jakov » Wed Oct 11, 2023 1:11 pm

Hi,
my example:
bulkrenameutility.co.uk
bulkrenameutility.co.ukk
bulkrenameutility.co.uk45hyu
bulkrenameutility.co.uk_7knsf
...etc

I want to remove from the first dot (for example) to end of the file name to be like this
bulkrenameutility
bulkrenameutility
bulkrenameutility
bulkrenameutility

Thanks
Jakov
 
Posts: 55
Joined: Sat May 23, 2020 1:29 am

Re: Remove from certain character to the end of file name

Postby therube » Wed Oct 11, 2023 4:19 pm

1:Regex
Code: Select all
Match:  ^(.*?)\.
Replace: \1

Match from the start of the name, anything, non-greedy, up to the first "." (dot).
Only keep what was matched.

If you also want to remove the file extension:
Renaming Options -> File/Folder Extensions --> Rename File Extensions As Being Part of File Name (enable)
therube
 
Posts: 1367
Joined: Mon Jan 18, 2016 6:23 pm

Re: Remove from certain character to the end of file name

Postby Jakov » Wed Oct 11, 2023 9:07 pm

Thanks so much
What if want to keep from second dot or third ...etc
for example
bulkrenameutility.co.uk
to
bulkrenameutility.co
Thanks again
Jakov
 
Posts: 55
Joined: Sat May 23, 2020 1:29 am

Keep the 1st/2nd/3rd/etc '.text-strings' and delete the rest

Postby Luuk » Wed Oct 11, 2023 11:32 pm

To keep everything unto the 1st .text-string, can use a "Match" and "Replace" like...
^([^.]+((\.[^.]+){1}))
\1

Must then edit the number, depending on how many .text-strings to keep.
Luuk
 
Posts: 771
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove from certain character to the end of file name

Postby Jakov » Thu Oct 12, 2023 10:45 am

Dear therube and Luuk,
Thank you and I'm sorry for annoying you
Each time, I face a new condition
1,
nnnnnn - (V) bulkrenameutility.co.uk
V= string variable in length
to
bulkrenameutility
So I want to remove from the first until ")" and remove the from the end at the first or second dot
2
nnnnnn(V).bulkrenameutility.com
to
bulkrenameutility
I want to keep the middle of the file name, which may be flanked by two dots, or dash,or underscore ...etc
Again thank you
Jakov
 
Posts: 55
Joined: Sat May 23, 2020 1:29 am

Keep some .strings end, Remove leading *.(string). if .==??

Postby Luuk » Fri Oct 13, 2023 8:03 pm

Its unfortunate, but Im not understand the different descriptions.
Are the (variable-string-lengths) always bordered by two "-/./_/ " ??
Or are they at least, always terminated by one of these characters ??

If you have more terminating/bordering characters, should list them instead of using etc.
Especially if you ever need to keep the character after your (variable-string-lengths) ??
Luuk
 
Posts: 771
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To


cron