Text.Select
TextReturns a text value containing only the characters from the input that match the specified selector.
Syntax
Text.Select(text as nullable text, selectChars as any) as nullable textParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | The text to filter. |
selectChars | any | Yes | A character, list of characters, or a character class specification (such as a range) identifying which characters to keep. |
Return Value
text — A text value containing only the characters that satisfy the selector.
Remarks
Text.Select is the complement of Text.Remove — it keeps only the characters you specify and discards everything else. The selector can be a single character, a list of characters, or a character class range such as {"0".."9"} to keep only digits.
This is useful for extracting numeric digits from mixed text, keeping only alphabetic characters, or filtering to a known safe character set.
Examples
Example 1: Extract digits from a mixed string
Text.Select("Phone: 555-1234", {"0".."9"})Result
Result | |
|---|---|
| 1 | 5551234 |
Example 2: Keep only alphabetic characters
Text.Select("Hello, World! 123", {"A".."Z", "a".."z"})Result
Result | |
|---|---|
| 1 | HelloWorld |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks