HashTags function

Applies to: Canvas apps Model-driven apps

Extracts the hashtags (#strings) from a string of text.

Description

The HashTags function scans a string for hashtags. Hashtags start with a pound character (#), which is followed by any combination of:

  • uppercase and lowercase letters
  • numerals
  • underscores
  • currency symbols (such as $)

HashTags returns a one-column table that contains the hashtags in the string. If the string contains no hashtags, the function returns a one-column table that's empty.

Syntax

HashTags( String )

  • String - Required. String to scan for hashtags.

Examples

Step by step

  1. Add a Text input control, name it Tweet, and type this sentence into it:

    This #app is #AMAZING and can #coUnt123 or #123abc but not #1-23 or #$*(#@")

  2. Add a vertical custom gallery, and set its Items property to this function:

    HashTags(Tweet.Text)

  3. Add a Label control to the gallery template.

    The gallery shows these hashtags:

    • #app
    • #AMAZING
    • #coUnt123
    • #123abc
    • #1