如何从字符串中提取用户名?

我一直在用这段代码为Java中的不和谐机器人写过一段时间:

Pattern pattern = Pattern.compile("\\/setNickname ([^\\s]+)");
        Matcher matcher = pattern.matcher(messageReceivedEvent.getMessage().getContentRaw());

        boolean foundMatch = matcher.find();
        if (foundMatch && matcher.groupCount() > 0) {
            String discordUserId = messageReceivedEvent.getAuthor().getId();
            String extractedName = matcher.group(1);

To change nicknames based on the text a user enters into the channel in the format of: [HH:MM:SS] /setNickname Bill

This code works correctly. However, I am now wanting to change it, but I cannot seem to get the regex pattern to work for a new format of the message. It is always a message the player has to enter with a timestamp, so the entry would be : [HH:MM:SS] Bill 4cYaUTKzT2odRf2

在某个时候,我计划以此为基础并使其成为变量,因此在第二个空格之前和之后消除似乎是最合乎逻辑的选择,但我为此而苦苦挣扎。

任何帮助,将不胜感激!