How to add certain letter before numbers in file name?

A swapping-ground for Regular Expression syntax

How to add certain letter before numbers in file name?

Postby Jakov » Sat Apr 17, 2021 4:45 pm

Hi All

Please I have a list of portable app with a file name such as
Hard Disk Sentinel 5.70.2 Portable
IObit Uninstaller Pro 10.4.0.12 Portable ...etc

So, how to add letter v (for version) before numbers in the file name in order to be :
Hard Disk Sentinel v5.70.2 Portable
IObit Uninstaller Pro v10.4.0.12 Portable.

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

Re: How to add certain letter before numbers in file name?

Postby Luuk » Sat Apr 17, 2021 6:20 pm

Im thinking the easiest way is with RegEx(1) using a Match and Replace like...
(.* )(\d+\.\d+[.\d]* [Pp]ortable.*)
\1v\2

It wants "space" in front of 'number' and 'portable', and also wants 'number' to have at least 1 period.
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to add certain letter before numbers in file name?

Postby Jakov » Sun Apr 18, 2021 2:46 am

Wow,
Thanks so much my bro
I appreciate your help
Best Regards.
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: How to add certain letter before numbers in file name?

Postby Jakov » Tue Apr 20, 2021 11:12 am

Luuk wrote:Im thinking the easiest way is with RegEx(1) using a Match and Replace like...
(.* )(\d+\.\d+[.\d]* [Pp]ortable.*)
\1v\2

It wants "space" in front of 'number' and 'portable', and also wants 'number' to have at least 1 period.


My bro, I am sorry about annoying you, but please can you give regex code if I want to add certain text such as "Repack" before the certain text in the file name such as version number;
ex:
Abelssoft Tagman v2016.2.11
Ashampoo Red Ex v1.0.0 ... etc

I want to add "Repack" before file version in order to be :
Abelssoft Tagman Repack v2016.2.11
Ashampoo Red Ex Repack v1.0.0

I will be so happy if you give me the code
Again, million thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am


Return to Regular Expressions