'Replace string value in PowerBI using a wildcard

I have a list of Points below that are in a column and i am trying to find all and replace them with just MaTmp. I want to do like in excel with find and replace and use MaTmp and replace with MaTmp. Any ideas?

Points
MaTmp01
MaTmp02
MaTmp1
MaTmp-1
MaTmp2
MaTmp-2
MaTmp3
MaTmp-3


Solution 1:[1]

Here's one way using Power Query M Code:

Paste the code into a blank query and examine the Applied Steps to better understand what's happening

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k0MyS0wMFSK1YGxjRBsJGFdJDaSCl0ktjGSMJAdCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Points = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Points", type text}}),
    MaTmp = Table.TransformColumns(#"Changed Type", {"Points", each if Text.StartsWith(_,"MaTmp") then "MaTmp" else _})
in
    MaTmp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1