Why does this regexp test return true

hey campers,

if anyone could explain this it would be much appreciated

// regex to return true if a string has a whitespace character 
// followed by a dot, comma, colon, or semicolon

console.log(/\s(.|,|:|;)/.test(" hi"));

thank you very very much

. is a special symbol that matches any character

1 Like

oh wow, what a legend - thank you!

https://regex101.com/ is your friend.