How does one string capture a player's username?

How do I capture a string of a username which includes capturing lowercase characters, uppercase characters, numbers and underscores.

1 Like

Are you saying, get a player’s username and to make it random characters?

Usernames can contain

So you would be capturing the entire username. Or what is it that you want to do.

I’m using string.match and was wondering what character classes like (%a+) or (%w+) capture lowercase characters, uppercase characters, numbers and underscores. Ideally a player’s username.

You could use the pattern [%w+_] to match alphanumeric characters and underscores.

1 Like

Alright so I tried using ([%w%p]+) and it worked. I wouldn’t have gotten it without your reference to the brackets of a set. I’ll set your reply as a solution.