Text.PositionOfAny Function in Power Query

The Text.PositionOfAny function in Power Query returns the first position in the text value of any listed character (-1 if not found).

Syntax

Text.PositionOfAny(
    text as text, 
    characters as list, 
    optional occurrence as nullable number
) as any

The function has the following parameters:

Returns The zero-based position of the first (or last) occurrence of any character from the list. Returns -1 if none are found.

Example: Characters not found in the text.

Power Query M

let
    Source = Text.PositionOfAny("Ashish Coder", {"S", "R"})
in
    Source   

The output of the above code is -1.

Example: Characters found in the text.

Power Query M

let
    Source = Text.PositionOfAny("Ashish Coder", {"i", "r"})
in
    Source   

The output of the above code is 3.