I have a string like
"i have #newCar and the #noTime in #Days"
and I want to extract words starting with #
:
a = "#newCar","#noTime',"#Days"
How can I do this ?
I have a string like
"i have #newCar and the #noTime in #Days"
and I want to extract words starting with #
:
a = "#newCar","#noTime',"#Days"
How can I do this ?
You can use a regex for this purpose
const s = "i have #newCar and the #noTime in #Days"
const regex = /#[a-zA-Z]+\b/g
console.log(s.match(regex)) // ["#newCar", "#noTime", "#Days"]