Skip to main content
Post Closed as "Duplicate" by T.J. Crowder jquery
edited tags, and this has nothing whatsoever to do with jQuery
Source Link
T.J. Crowder
  • 1.1m
  • 201
  • 2k
  • 2k

Multiple keyword select from a string of text using jQuery

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 jQuerythe .match().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 using jQuery?

Multiple keyword select from a string of text using jQuery

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 jQuery .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 using jQuery?

Multiple keyword select from a string of text

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?

edited tags
Link
T.J. Crowder
  • 1.1m
  • 201
  • 2k
  • 2k
Source Link

Multiple keyword select from a string of text using jQuery

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 jQuery .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 using jQuery?