const extractHashtags = (text) => { // Regex to find words starting with #, followed by alphanumeric characters and underscores const hashtagRegex = /#([a-zA-Z0-9_]+)/g; const matches = text.match(hashtagRegex); if (!matches) { return []; } // Remove the '#' prefix from each tag return matches.map(tag => tag.substring(1)); }; console.log(extractHashtags("This is a #test with #multiple #hashtags_123 and #anotherOne.")); // Expected: ["test", "multiple", "hashtags_123", "anotherOne"] console.log(extractHashtags("No hashtags here.")); // Expected: [] console.log(extractHashtags("#javascript #webdev #programming")); // Expected: ["javascript", "webdev", "programming"]