Regex to replace dots in filename with exception

A swapping-ground for Regular Expression syntax

Regex to replace dots in filename with exception

Postby spilet » Wed Jun 21, 2017 9:40 pm

Hello,
I need to replace "." characters With Space except dots who located between digits.


Here is two example:

Before Regular Expression --> AMD.Crimson.Drivers.17.4.3.win.8.1.WHQL.x64.exe
After Regular Expression ----> AMD Crimson Drivers 17.4.3 win 8.1 WHQL x64.exe

Before Regular Expression --> BitTorrent.Pro.7.10.0.5.2.Build.43581.Portable.exe
After Regular Expression ----> BitTorrent Pro 7.10.0.5.2 Build 43581 Portable.exe


Someone can help me ?
Thanks in advance :wink:
spilet
 
Posts: 2
Joined: Wed Jun 21, 2017 9:00 pm

Re: Regex to replace dots in filename with exception

Postby spilet » Tue Jun 27, 2017 5:40 am

I try this in more than one step :

Match :
(.*)(\d{1,})(\s)(\d{1,})(.*)

Replace :
\1\2.\4\5

Does anyone have a better idea?
spilet
 
Posts: 2
Joined: Wed Jun 21, 2017 9:00 pm

Re: Regex to replace dots in filename with exception

Postby gavcol » Tue Jul 30, 2019 11:04 am

Is there any other suggestion to this ?
I'm using Replace(3) to replace . with a space
and in Case(4) I'm using Title to set Proper caps and the Excep. field has multiple values separated by a :

This works mostly but the excep doesn't work with any exceptions that contain a .
e.g. ABC:DEF:GHI.4:JKL.9

Filenames containing ABC & DEF are left alone but GHI.4 & JKL.9 are changed to
Ghi 4
Jkl 9

How do set an exception to force anything containing a . within the : : to be excepted/ignored ?

Thanks in advance
Gav
gavcol
 
Posts: 7
Joined: Thu Sep 20, 2018 2:43 pm


Return to Regular Expressions


cron