Read the manual section on "Pattern Syntax".
What you have is actually invalid. I'll assume that the last \ is supposed to be a /
/
Start of the regular expression
^
Match start of $str.
\w
Match any word-like character (letter, digit, or underscore).
[
Start a character class.
\w
Match any word-like character.
]
End the character class.
*
Zero or more repetitions of the preceding part of the expression (the character class in this case).
\w
Match any word-like character.
$
Match the end of $str.
/
End of the regular expression.
i
Use case-insensitive matching.
The character class is unneeded, since \w is already a character class in its own right, so why say "the set of all characters in the set of all word-like characters" when you can just say "the set of all word-like characters"?
The regexp then becomes
/\w\w*\w$/i
As you point out, \w matches upper- and lower-case letters anyway, and there are not other letters to worry about, so the 'i' flag is redundant:
/\w\w*\w$/
"\w\w*" Means "a word-like character followed by zero or more word-like characters" - in other words, "one or more word-like characters":
/\w+\w$/
And that can be continued. One or more word-like characters followed by a word-like character is the same as "two or more word-like characters". There isn't a single operator like * or + to express this, but there is the range operator {m,n} - where m is the minimum and n is the maximum; there is no maximum in this case, so that bit stays blank, while the minimum is of course 2:
/\w{2,}$/
In other words, match any string consisting entirely of two or more word-like characters.
And that's what the whole expression means.