Saturday, February 3, 2018

JavaScript Regex: Match all hashtags, only capture text after hash character

I am trying to match text after a hashtag.



Here is my current progress:




String: "Here sometext #BestRappaAlive #CategoryK #test #sadsadsadsa some more text"



Regex: /(?:#)(\w+)\b/g



Desired output: ["BestRappaAlive","CategoryK","test","sadsadsadsa"]



Current output: ["#BestRappaAlive","#CategoryK","#test","#sadsadsadsa"]



This seems trivial (I can just loop and slice) but I am curious as to where I am going wrong.




https://regexr.com/3oop4

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...