I have a problem with regex. I would like to make a test to see if a string contains a word char. If it contains a word char it should alert true. And for some reason this alerts true. What am i doing wrong? I'm pretty positive that this shouldn't alert true.
if (/\w/.test('23')) {alert('true')}
"2"
and"3"
are alphanumeric characters.\w
doesn't mean "word character;" it means "alphanumeric character," as @NobleMushtak pointed out.