从 Power 查询中的文本列中提取模式

问题描述 投票:0回答:1

我想从文本列中提取与“RXXXXX”等模式匹配的单词到新列中。该单词以字母“R”开头,包含字母数字字符,分隔符可以是“;”或什么都没有。字长可以变化。以下是所需的输入和输出示例

enter image description here

excel powerbi powerquery powerbi-desktop m
1个回答
0
投票
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkktLlGK1YlWCjIx0jNU8HWMNDQ2MrF29AjVDQnKcXR3hUoaQySNgJJgEYQCaxRJ65CMVAWfTKihuFQpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Input = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Input", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let a = Text.Split([Input], ";"),
b = List.Select(a, each Text.StartsWith(_,"R"))

in b{0}?)
in
    #"Added Custom"

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.