Detecting Hashtags And @ In String
I am trying to detect hashtags and @ and add the class to the world so as I can add a styling. Right now it is working but I am iteration over text twice. Can I do it with a one st
Solution 1:
You can just use this in the regex:
/(^|\s)([#@][a-z\d-]+)/
To match both @ and #.
Post a Comment for "Detecting Hashtags And @ In String"