I'm trying to create a post having tags in between. So I'm trying to retrieve all the keyword which are followed by # using simple regex expression.
var hashtag = $('p').text().match(/#\w+\s/); console.log(hashtag); I'm using the .match() function to find the match of the defined regex expression, but it is only displaying one keyword, whereas I have two.
Is there any way to retrieve multiple keywords?
matchisn't a "jQuery function." It's a JavaScript standard library function. jQuery is just a DOM manipulation library (plus some utilities)..match(/#\w+\s?/g)maybe? Should be global and and the space on the end is optional?