Tell us what’s happening:
i already used shorthand character(\w) in code but it still not accepting and output screen shows
(Your regex should use the shorthand character)
Your code so far
let quoteSample = “The five boxing wizards jump quickly.”;
let alphabetRegexV2 = /[A-Za-z0-9_]/g;
let shortHand = /\w+/;
let result = quoteSample.match(alphabetRegexV2).length;
\w is for Word, not letter.
1 Like
\w
doesn’t match a word. It matches a single letter, number, or underscore.
1 Like
i used \W instead of \w and it worked!,thank u for quick respond.
i used \W instead of \w and it worked!
May I ask why in the example of this exercise they used /\w+/ instead of /\w/?
ilenia
December 7, 2019, 3:13pm
7
\w
matches one single word character, \w+
matches one or more.
Using one or the other depends on what you want your output to be
More than this you will need to post the challenge link, or it is difficult to answer the question
1 Like
I used console.log and I just realized that /\w+/ matches the words that meet the criteria, whereas /\w/ matches the total of characters that meet the criteria