Regular expression * question

Tell us what’s happening:

I’m on the Regxr.com site and I cannot understand why the * symbol works the way it does in this example:

b\w*
b be bee beer beers

The example highlights all the characters. I don’t understand why the Regexr even looks at the letter “e” when the equation shows the “b”. So is it doing an equation for after “b”.

Your code so far


let hello = "   Hello, World!  ";
let wsRegex = /^(\s+)(\s+$)/; // Change this line
let result = hello.replace(wsRegex, ''); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end

When you write
/b\w*/ you have three things inside here
First there is a b,
Then you have \w which is a word character (word characters are a-z, A-Z, 0-9, and underscore)
Then you have *which means zero or more
So your regex means "b followed by 0 or more word characters"