Code: Select all
hostname = %A_computername%
String = %hostname%
msgbox,string %String%
input = % SubStr(String, -4)
msgbox, input %input%
MsgBox % RegExReplace(input, "[-]")
Code: Select all
hostname = %A_computername%
String = %hostname%
msgbox,string %String%
input = % SubStr(String, -4)
msgbox, input %input%
MsgBox % RegExReplace(input, "[-]")
Code: Select all
MsgBox % input := SubStr("askdhgfjsd34-87", -4) ; "34-87"
MsgBox % RegExReplace(input, "[-]") ; 3487
Code: Select all
hostname = %A_computername%
;Sets the computer name as variable hostname
msgbox,HostName %hostname%
;displayd the hostname in my case Thundera
hostname := % SubStr(hostname, -4)
;Parses the last five 'ndera' and changes the hostname variable to 'ndera'
msgbox, Hostname %hostname%
;Shows 'ndera' as expected
MsgBox % RegExReplace(hostname, "[er-]")
;does not parse out the 'er-' from the name
Return
Code: Select all
hostname = %A_computername%
String = %hostname%
stringreplace, string1,string, e,, all
msgbox,string %String%
msgbox,string1 %string1%
input = % SubStr(String1, -4)
msgbox, input %input%