Extract Hashtags

Easy ⏱ 8 min 83% acceptance ★★★★☆ 4.3
Write hashtags(post) returning every hashtag in a social post — a # followed by letters/digits/underscores, at least one character — lowercased and without the #. re.findall with one capturing group returns just the group.

Examples

Example 1
Input
hashtags('Learning #Python and #SQL_2026! #')
Output
['python', 'sql_2026']
Explanation

The bare # matches nothing; tags are lowercased.

Constraints

  • Tag chars: [A-Za-z0-9_]+.
  • Return lowercase, no # prefix.

Topics

Regular Expressionsfindall

Companies

MetaX CorpShareChat

Hints

Hint 1

Pattern: #(\w+).

Hint 2

findall returns the captured group directly.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.