\w
matches a single character (only), so the parentheses (\w)
captures a single character.Any remaining characters are matched by the
\w*
expression. The asterisk allows it to match repeatedly. Without the parentheses, the characters are not captured.