How to remove dots between words in file name?

Bulk Rename Utility How-To's

How to remove dots between words in file name?

Postby Jakov » Sat May 23, 2020 1:32 am

Hi All
please how to remove dots between words only (Not numbers) in file name and replace it with space by using Bulk Rename Utility

Thanks in advance
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby Admin » Sat May 23, 2020 3:55 am

Hello, please provide a few examples, from -> to (usually at least 5 examples would be useful) thanks
Admin
Site Admin
 
Posts: 2341
Joined: Tue Mar 08, 2005 8:39 pm

Re: How to remove dots between words in file name?

Postby Jakov » Sat May 23, 2020 11:12 am

Hi Admin
Please I have list of apps with dots between words in file name such as

Nitro.Pro.13.15.1.282.Ent_x64
Movavi.Photo.Editor.Repack.v4.4.0
NCH.PhotoPad.v6.13
Home.Photostudio.Repack.v16.0
Microsoft.NET.Core.Desktop.Runtime.v3.1.4_x64

So I want to remove dots between words to be such as
Movavi Photo Editor Repack v4.4.0 (I removed the dots manually)
Thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby therube » Sat May 23, 2020 12:42 pm

(Noted elsewhere, he wants to remove the dots only between the alpha characters, not the numbers.)
therube
 
Posts: 1310
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to remove dots between words in file name?

Postby RegexNinja » Sat May 23, 2020 3:23 pm

Hi.. To only preserve dots with a bordering number, the easiest way is with javascript:
newName = name.replace(/([^\d])\.(?![\d])/g, '$1')

Results:
1.a.b.c.d.2.3.4.5.6 -------------------------------------> 1.abcd.2.3.4.5.6
12.34.a.b.c.56.78 ---------------------------------------> 12.34.abc.56.78
a.b.c.d.e.f1.g.h.i ---------------------------------------> abcdef1.ghi
Home.Photostudio.Repack.v16.0 ----------------------> HomePhotostudioRepackv16.0
Microsoft.NET.Core.Desktop.Runtime.v3.1.4_x64 --> MicrosoftNETCoreDesktopRuntimev3.1.4_x64
Movavi.Photo.Editor.Repack.v4.4.0 -------------------> MovaviPhotoEditorRepackv4.4.0
NCH.PhotoPad.v6.13 ------------------------------------> NCHPhotoPadv6.13
Nitro.Pro.13.15.1.282.Ent_x64 ------------------------> NitroPro.13.15.1.282.Ent_x64

Otherwise, you'd have to resort to using a fairly complicated-looking regex match/replace like:
^([^\d\.]+)*\.*([\d\.]+)*\.*([^\d\.]+)*\.*([\d\.]+)*\.*([^\d\.]+)*\.*([\d\.]+)*\.*([^\d\.]+)*\.*([\d\.]+)*\.*(.*)
\1\2\3\4\5\6\7\8\9


The regex-method works eventually, but can take several renames to get the same results.
For instance, names like: a.b.c.d.e.f1.g.h.i.j.k would need several renames.
Cheers.
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Re: How to remove dots between words in file name?

Postby Jakov » Sat May 23, 2020 9:42 pm

Thanks for your time
But Iam not understand anything from these codes
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby trm2 » Sun May 24, 2020 3:31 am

If you want the <space> character as indicated in the request, just a simple change:

newName = name.replace(/([^\d])\.(?![\d])/g, '$1 ')

<space> was added after $1

the $1 is another way of stating \1 for the Replacement String.
the /g is the global switch meaning match everything in the string - unlike BRU RegEx which is limited to the first match only - that is why RegEx Ninja stated that
the RegEx he\she provided would have to be run numerous times to obtain the desired result.
The JavaScript is basically running a RegEx using a global switch.

This would look like this in RegEx:

Match: ([^\d])\.(?![\d])
Replace: \1

Of course this wouldn't work in RegEx - again, the other code Regex Ninja provided would. I am just showing you what the JavaScript is doing.
It matches against any character that is not a numeric digit (the [^\d] is a Negated class meaning don't match against a numeric digit - represented by the \d) until it hits a <dot> ( the \.)
then it looks ahead to see that there are not ( the (?![\d]) is a negative lookahead) any numeric digits after the <dot>. Because of the global switch,
it continues to try and match against this pattern until the string is exhausted and no more matches can be made. There is only one Capture Group - Capture Group1 = ([^\d]), the other is called
a Non-Marking Group ( the Negative Lookahead belongs to a Non-marking Group) and does not capture.

So it matches letters with dots and ignores numeric digits. The dot is removed in a sense because it is not captured - the \. is the dot and it is not in parentheses so it is not captured.

You end up with a collection of letters together, and numeric digits with preserved dots. The <space> that you wanted is added in the Replacement String '$1 <space>'

If you still do not understand, then at least you have the code. Please refer to the RegEx Manual found in the appendix of my book, Bulk Rename Utility Operations Manual Volume I for further explanations.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: How to remove dots between words in file name?

Postby Jakov » Sun May 24, 2020 4:39 am

Thanks so much
Please Iam not experience in Bulk Rename Utility
So how to reach Javascript in Bulk Rename Utility in order to apply these codes
Thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby trm2 » Sun May 24, 2020 4:52 am

It is found in Section #14: JavaScript - you click on the box and it brings up a data entry form where you can enter or in this case, copy and paste the code in.
If you have not registered the program (cost is about $100 - low cost for what you get), then you can only use the Test facility. This simply checks the syntax to make sure it will run
without problems.

If you have the registered version (aka called the commercial version) then it will run the code. You really don't have the real power of BRU without it - there is however, a learning curve
for JavaScript. In Volume II, there will be numerous examples where you can plug in the code and see it work - and after a while, you may pick it up in bits and pieces as I have.

Registering the program supports further development not just for the paid version but for the freeware versions as well. I believe even now they are working on a new version.

So if you can, show your support and save your pennies and register for the paid version in the future. The Admin is always willing to help as well as therube, RegexNinja and perhaps others
to develop a JavaScript solution to a problem.

It sounds like you do not have the paid version, so you would be better off using the RegEx (Regular Expression) code that RegexNinja provided. Remember though it requires multiple runs to get the desired outcome.
If you are totally new to the program, then I suggest downloading my book, Bulk Rename Utility Operations Manual Volume I - look for it as the first entry to the How-To section of this forum. I don't have the link at hand at the
moment. This book explains every function of BRU in detail. There is even a RegEx manual found in the appendix. Volume II, when released will have a companion manual to this in the appendix as well.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: How to remove dots between words in file name?

Postby Jakov » Sun May 24, 2020 5:12 am

You are awesome my bro
Thanks so much my lover
last thing please
The code does not remove dots between words and numbers (it appear as (Driver Booster Repack.7.4.0.730))
So I want to remove dots between words, between words and numbers , but not between numbers
like this (Driver Booster Repack 7.4.0.730)
So if you can do this please give me the code with special thanks
Best Regards
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby RegexNinja » Sun May 24, 2020 6:57 am

Jakov
Sorry, I thought you wanted to remove the dots, not replace them with spaces.
I also assumed that you wanted to keep dots that had a number on either side.
If I'm understanding correctly, this is prob what you want (much easier):

newName = name.replace(/([^\d])\.+/g, '$1 ')

Results:
a.b.c.........d.e.f.g.h.i ----------------------------------> a b c d e f g h i
Driver.Booster.Repack.7.4.0.730 ------------------------> Driver Booster Repack 7.4.0.730
Home.Photostudio.Repack.v16 --------------------------> Home Photostudio Repack v16
Microsoft.NET.Core.Desktop.Runtime.v3.1.4_x64 ----> Microsoft NET Core Desktop Runtime v3.1.4_x64
Movavi.Photo.Editor.Repack.v4.4.0 ---------------------> Movavi Photo Editor Repack v4.4.0
NCH.PhotoPad.v6 ------------------------------------------> NCH PhotoPad v6
Nitro.Pro.13.15.1.282 ------------------------------------> Nitro Pro 13.15.1.282

It replaces ANY string-of-dots that dont have a number in front of them with a space.
Sorry for the confusion.. Cheers!
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Re: How to remove dots between words in file name?

Postby trm2 » Sun May 24, 2020 2:09 pm

RegexNinja

One problem on this sample - the output is:

a b c d e f1.g h.i

Not

a b c d e f1.g h I

There is still a dot after the h that remains.

It should be noted that the .h is treated as an extension. To get the desired results, the user will have to enable
'Rename File Extensions As Being Part of the File name' from the 'File/Folder Extensions' sub-menu of the 'Renaming Options menu'

Then you will achieve:

a b c d e f1.g h I
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: How to remove dots between words in file name?

Postby Jakov » Sun May 24, 2020 3:55 pm

Thanks so much (RegexNinja and trm2)

RegexNinja ------> your code is awesome (newName = name.replace(/([^\d])\.+/g, '$1 ')) its work 100% for me :) .
trm2 ------> Thanks for any explanation.

I can not thank you enough
Thanks my bro
Best regards
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby Jakov » Sun May 24, 2020 4:55 pm

RegexNinja

Please I found another problem which is:
the result of the code on files name such as (PDF.Desktop.6.0.8.x64) is (PDF Desktop 6.0.8.x64)
I agree with you that your code is working 100% but look its does not remove dots between last number of file version and x64 (6.0.8.x64)
So if can do this, please give me the code
if not , do not waste your time, I will do it manually.

Finally, I appreciate your efforts and time.
Best regards
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to remove dots between words in file name?

Postby RegexNinja » Mon May 25, 2020 3:15 am

Jakov
No problem at all.. Right now, it wont touch any dots that have a number in front of them.
Its an easy fix, but what should the NewName be ??

What should happen with . when its part of a version# like: v3.1.4.x64 ??
I've noticed some of your files have version-numbers like::: v3.1.4_x64 (convert to underscore?)
Or would you rather insert a space into the version-number: v3.1.4 x64
Or should the . be completely removed, for something like:: v3.1.4x64

Here's an example to replace it with an underscore:

a = name.replace(/([^\d])\.+/g, '$1 ')
newName = a.replace(/^(.*\d)\.(x64|x86)$/,'$1
_$2')

It relies on x64/x86 being at the end of a filename, if that's not always the case, just let us know.
Cheers!
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Next

Return to How-To