lolp1 Posted May 29, 2007 Posted May 29, 2007 Hello, Well I fairly understand string trim, but I don't understand how it can be put into use for non static text.. For example "input" I have is this: [07:15] Europe: [15:18:01] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-139. [07:18] Europe: [15:20:48] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-140. [07:22] Europe: [15:24:22] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. [07:24] Europe: [15:26:25] <From Vic(Bot)> Your friend Vic(Bot) has exited Battle.net. It will always have different time stamps, and different game name at the end, but I would like my output like: Europe:Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. How could I do this? For to be more clear: Input = Europe: [15:24:22] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. What out put I would want: Europe:Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. Keep in mind the game name, and time stamps are always different..
Zedna Posted May 29, 2007 Posted May 29, 2007 (edited) Use StrinRegExpReplace()But with pattern I can't help you, I'm regexp newbie Edited May 29, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
lolp1 Posted May 29, 2007 Author Posted May 29, 2007 Use StrinRegExpReplace()But with pattern I can't help you, I'm regexp newbie Not sure, what this is for... :E
Zedna Posted May 29, 2007 Posted May 29, 2007 Then look into Autoit Helpfile. Resources UDF ResourcesEx UDF AutoIt Forum Search
lolp1 Posted May 29, 2007 Author Posted May 29, 2007 Then look into Autoit Helpfile.I did, the func does not exsist.. or at least auto it doesn't want to be nice and find it. I'm fairly sure Stringtrim is still the way to go..
Zedna Posted May 29, 2007 Posted May 29, 2007 I did, the func does not exsist.. or at least auto it doesn't want to be nice and find it. I'm fairly sure Stringtrim is still the way to go..Sorry for my missing "g"StringRegExpReplace Resources UDF ResourcesEx UDF AutoIt Forum Search
lolp1 Posted May 29, 2007 Author Posted May 29, 2007 Still, does not help me figure out my problem on how to deal with non-static text..
ResNullius Posted May 29, 2007 Posted May 29, 2007 For to be more clear: Input = Europe: [15:24:22] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. What out put I would want: Europe:Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141. Here's a solution that doesn't use RegExp, just looking for the constant reappearing characters as markers for regular String functions (StringLeft, StringTrimLeft, and StringReplace) ;what we have $string = "Europe: [15:24:22] <From Vic(Bot)> Your friend Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141." ;what we want $desired = "Europe:Vic(Bot) entered a Diablo II Lord of Destruction game called Talibaal-141." ; Find the first instance of ":" in the string ;the trailing "1" option finds first instance only $FindFirstColon = StringInStr($string,":",0,1) ; take the characters up to & including the colon as the first part of output $outPut = StringLeft($String,$FindFirstColon) ;Find the first ">" in the the string $findEndFrom = StringInStr($string,">",0,1) ;get rid of everything at the beginning of the string up to & incl. the ">" $String = StringTrimLeft($String,$FindEndFrom) ;strip " Your friend " out from remaining string $String = StringReplace($string," Your friend ","",1,0) ;join the two pieces of our output together $Output &= $String MsgBox(4096,""," Output = " & $OutPut & @CRLF & "Desired = " & $Desired) Hopefully you won;t just cut and paste but will study what was done here so you can learn from it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now