Text.Select Function in Power Query

The Text.Select function selects all occurrences of the given character or list of characters from the input text value.

Syntax

Text.Select(text as nullable text, selectChars as any) as nullable text

Example: Select all occurrence of the character in the given text.

Power Query M

let
    Source = Text.Select("Ashish Coder is the best website.", "e")
in
    Source  

The output of the above code is “eeeee”.

Example: Select all occurrence of the given character in the given text.

Power Query M

let
    Source = Text.Select("Ashish Coder is the best website.", {"A", "i", "e"})
in
    Source  

The output of the above code is “Aieieeeie”.

Example: Select all characters in the range of 'a' to 'z' from the text value.

Power Query M

let
    Source = Text.Select("Ashish Coder is the best website.", {"a".."z"})
in
    Source  

The output of the above code is "shishoderisthebestwebsite".

Example: Select all characters in the range of small characters 'a' to 'z', Capital characters ‘A’ to ‘Z’, space “ ”, and a dot “.” from the text value.

Power Query M

let
    Source = Text.Select("Ashish Coder is the best website.", {"a".."z", "A".."Z", " ", "."})
in
    Source  

The output of the above code is "Ashish Coder is the best website.".