Saturday, 3 February 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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...