Personally I think the best option is just /[a-z0-9]/i or if you don’t want the i flag /[a-zA-Z0-9]/, or you can substitute0-9 with \d.
If you insist on using \w, you can use lookahead assertion i.e. try /(?=[^_])\w/, or, worse, lookbehind assertion /\w(?<=[^_])/ both of which I think are actually less elegant.