Why not add a `$` at the end of the regexp, i.e., `/^\w+$/`?