Search a string in a string and replace (vbscript or Python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Search a string in a string and replace (vbscript or Python)

Hello everybody. I would like to replace an extension in a string. For example: bonjour.exe -> bonjour.zip I search “.exe” And replace it by “.zip”. Thank you for your help.

13th Nov 2018, 5:30 AM
Abdel
Abdel  - avatar
5 Answers
+ 1
Woaw!!! Thank you Jay. Very simple and it works!!! Do you know how to do it in Vbscript please?
13th Nov 2018, 5:41 AM
Abdel
Abdel  - avatar
+ 1
Thank you very much Jay for your help, i will try it today. An other thing, is it possible to search “.” and extract the string from the left to the “.” and add an other extension? Still in vbscript?
13th Nov 2018, 5:53 AM
Abdel
Abdel  - avatar
+ 1
Thank you so much Jay. Do you speak french?
13th Nov 2018, 6:10 AM
Abdel
Abdel  - avatar
+ 1
lol. it is hard for me computer languages. i amnstarting from zero. and it is hard.
13th Nov 2018, 6:39 AM
Abdel
Abdel  - avatar
+ 1
Hi Jay, I did the test on my computer, and the function replace was easy to assign. It works. Thanks a lot.
13th Nov 2018, 12:57 PM
Abdel
Abdel  - avatar