FETCHING HASHTAGS FROM TEXTAREA
dasguptahirak opened this issue · comments
Amazing Plugin. Hats off @yuku-t
Is there any function to fetch hashtags from textarea?
For example: if a user have type "hi #hirak and #yuku" in the textarea.
There would be a function called var tags=$('#myTextArea1').getTags() which will fetch all hashtags and return in the form of array.
i.e tags[0]="hirak" and tags[1]="yuku"
No, but it is easy to implement
$.fn.getTags = function () {
var regexp = /#(\w+)/g;
var value = this.val();
var match = regexp.exec(value);
var result = [];
while (match != null) {
result.push(match[1]);
match = regexp.exec(value);
}
return result;
};
Thanks a lot @yuku-t