Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Text.StartsWith with wildcards?

Hey folks.  I have a list with a bunch of values in it.  Using Power Query / M, I would like to search for all fields that start with "Q#", with # being a wildcard for a single numeric value.  Everything I search says this isn't possible, but I'm really hoping I'm just not searching for the right word combination to come up with a solution.  Text.StartsWith would be perfect if it accepted wildcards.  Following is what I'm using that almost gets me there, but I need that numeric wildcard so I can filter down further to fields that start with "Q1" through "Q9".

 

 

= List.Select( #"Get List of Column Names", each Text.StartsWith( _, "Q"))

 

 

  • = List.Select( #"Get List of Column Names", each Text.StartsWith( _, "Q") and List.Contains({48..57}, Character.ToNumber(Text.Range(_,1,1))))

3 Replies