Extract HashTags from String in Javascript or Node.js

// Extract HashTags from String in Javascript or Node.js
function getHashTags(inputText) {  
    var regex = /(?:^|\s)(?:#)([a-zA-Z\d]+)/gm;
    var matches = [];
    var match;

    while ((match = regex.exec(inputText))) {
        matches.push(match[1]);
    }

    return matches;
}

#javascript #nodejs

19.45 GEEK