Extracting text from a string

:dys0n!ggG@hideen-5BEE476A.popl.cable.ntl.com PRIVMSG #rolfz0rz :heg

if you look it says :dys0n! i need to extract dys0n any ideas?

I think what your looking for is **[String.Explode

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=String.Explode)**

[lua]
local function Extract( )

local str = ":dys0n!ggG@hideen-5BEE476A.popl.cable.ntl.com PRIVMSG #rolfz0rz :heg"
str = string.Explode( "!", str )

str[ 1 ] = string.gsub( str[ 1 ], ":", "" )

print( str[ 1 ] )

end[/lua]

That’s assuming there will always be an !

This question has already been answered via steam, he is using pattern matching.