Good evening everyone! JS / RegExp for some reason, one job swears, although the result is correct.
Your code so far
let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
//let chewieQuote = "He made a fair move. Screaming about it can't help you.";
//let chewieQuote = "Let him have it. It's not wise to upset a Wookiee.";
let chewieRegex = /a*/i; // Change this line
let result = chewieQuote.match(chewieRegex);
console.log(result[0].length + ' ' + result);
result = "He made a fair move. Screaming about it can't help you.".match(chewieRegex);
console.log(result[0].length + ' ' + result);
result = "Let him have it. It's not wise to upset a Wookiee.".match(chewieRegex);
console.log(result[0].length + ' ' + result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
You right, but without /i solved only examples from lesson, it not work for something as it “aAaaaaA”.
And yes, about flags written, but it not be focused.
Thanks.
that’s true, but if you write /a*/ you are just matching everything, even strings where there is not an a
instead you need to specifically match that string, chewieQuote without matching the others