textConvert
    Preparing search index...

    Function extractHashtags

    • Extracts all #hashtags found in a block of text, symbol included.

      Uses the same not-preceded-by-a-body-character rule as extractMentions, which has a useful side effect: it also keeps a language name like C# from being mistaken for a hashtag.

      Parameters

      • text: string

        Text to search for hashtags.

      Returns string[]

      An array of the hashtags found (including the leading #), in the order they appear.

      extractHashtags('Just shipped v2! #typescript #opensource #buildinpublic');
      // ['#typescript', '#opensource', '#buildinpublic']