I'm not asking anyone to write me any free scripts. I just want to be able to do this.
I'm trying to acquire a username from inside a string and then be able to see the stuff after that username. I tried using ;match() and then using :sub() inside to find the spot in the words, but to be honest I knew it wasn't going to work.
I'm not including the part where it checks if the word it's acquired is a username, because I can do that on my own and it's not what I'm having problems with.
local string = "[]Terminate Troidit test test." local termPlr = msg:match(msg,msg:sub(13)"%w+") local details = msg:sub(15) --This is just a random number right now. It's supposed to acquire the text after the username, but I don't know how to do that. print(termPlr.." "..details)
I feel kind of clueless after reading the string manipulation library on the Wiki here. Any help explaining or solving this problem would be greatly appreciated.
You should be able to use the%f
pattern although there are other patterns you could use.
FrontierPattern
"The frontier pattern %f followed by a set detects the transition from "not in set" to "in set". The source string boundary qualifies as "not in set" so it also matches the word at the very start of the string to be matched."
Example:-
local s = "[]Terminate Troidit test test." for w in s:gmatch("%f[%a].-%f[%A]") do -- .- will match as few of the preceding character of any character print(w) end
I hope this helps.