I need to remove from a variable two numbers followed by a space from 01 to 25. Could someone demonstrate how to do this instead of:
StringReplace, stitle, stitle, 01%A_SPACE%,,All
StringReplace, stitle, stitle, 02%A_SPACE%,,All
StringReplace, stitle, stitle, 03%A_SPACE%,,All
...
StringReplace
Re: StringReplace
Hi. Try this:
Code: Select all
stitle := "NiceTitle08 "
stitle := RegExReplace(stitle, "0[1-9]|1[0-9]|2[0-5] ", "")
MsgBox, % stitle
Re: StringReplace
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
-
- Posts: 4412
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: StringReplace
Code: Select all
stitle := "text08 text26 text18 text"
MsgBox, % RegExReplace(stitle, "(0[1-9]|1\d|2[0-5]) ")
- emmanuel d
- Posts: 90
- Joined: 17 Nov 2013, 04:45
Re: StringReplace
If you dont like regex: (untested code):
Substring is there so we always have 2 digits
Code: Select all
Loop,25
StringReplace, stitle, stitle,% SubStr(00 A_Index,-1) A_SPACE,,All
Who is online
Users browsing this forum: No registered users and 245 guests