I have this regular expression that puts all the words that starts with @ into span tags. I've accomplished what is needed but i'm not sure that i completely understand what i did here.
content.replace(/(@S+)/gi,"<span>$1</span>")
- The () means to match a whole word, right?
- The @ means start with @.
- The S means "followed by anything until a whitespaces" .
But how come that if don't add the + sign after the S , it matches only the first letter?
Any input would be appreciated .
See Question&Answers more detail:os