Code: Select all
local name = string.gsub(userinfo, "^3@+^1%w+", "")
well pattern machting...
--> a
^ represents beginning of a string! Escape it & it will match the color code
^3
Manual says: "You can use the escape `%´ not only for the magic characters, but also for all other non-alphanumeric characters. When in doubt, play safe and put an escape. "
edit: e.g.
Code: Select all
local name = string.gsub(userinfo, "%^3%@+^1[%S]+", "")
--> somewhere in that string: color code
^3, followed by one or more
@, color code
^1 and everything but a space character.
"^3@^1affenarsch more nick" --> " more nick"
"start ^3@^1affenarsch more nick" --> "start more nick"
or
Code: Select all
local name = string.gsub(userinfo, "%^3%@+^1.+", "")
--> somewhere in that string: color code
^3, followed by one or more
@, color code
^1 and everything else.
"^3@^1affenarsch more nick" --> ""
"start ^3@^1affenarsch more nick" --> "start "
greetz