I have a string that may contains Twitter hashtags. I'd like to strip it from the string. How should I do this? I'm trying to use the RegExp class but it doesn't seem to work. What am I doing wrong?
This is my code:
var regexp = new RegExp('\b#\w\w+');
postText = postText.replace(regexp, '');
This?
postText = "this is a #bla and a #bla plus#bla"
var regexp = /\#\w\w+\s?/g
postText = postText.replace(regexp, '');
console.log(postText)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With