Extract Hashtags

Pull hashtags out of a post, one per line.

The tags, without the rest of the post

A hashtag is a # followed by letters, digits or underscores. This page lists those tags, one per line, and leaves the sentence behind. It does not look for email addresses. That is extract emails.

How to use it

  1. Paste the post.
  2. Keep the # is on, so each line still starts with #. Turn it off to keep only the word.
  3. Drop duplicates is on. Comparison ignores case, so #HexToString and #hextostring count as one, and the first spelling is kept.
  4. Show example uses Launch day #HexToString #tools #hextostring and again #tools. With both options on, the result is #HexToString and #tools.

What is skipped

The # has to start a tag. A hash glued into the middle of a word, with a letter or digit before it, is ignored. The tag itself may contain letters from any script, digits and _. A bare #, or # plus punctuation, is not a tag. No match leaves the result empty. That is not an error. Order follows the post. Unique comparison uses a lowercase copy and does not rewrite the line you keep.

Where people use it

  • Collecting tags from a caption before you reuse them.
  • Checking that a Chinese tag such as #工具 was picked up.
  • Dropping a tag that was repeated in the same paragraph.

Questions

A hash in the middle of a word was ignored.

The character before # has to be a boundary, not a letter, digit or underscore.

Two spellings became one line.

Drop duplicates folds case. Turn it off to keep every occurrence.