Forum Discussion
joeywong
Helper I
3 years agoUse wildcard to extract words
Hi all,
I have a column with unstructured words. I need to extract the words.
AA | AA |
AAgotozoo | AA |
.AA | AA |
AA$$ | AA |
Zoneedto goAA | AA |
$$AA | AA |
I tried to add a condition column, but it only extracted certain words but not the complete list. Does anyone know how to use wildcards to extract the text?
Thanks!
7 Replies
- joeywong
Helper I
Hi Hnguy71,
It list a of text string.
Unpredictable nature is a pattern. It can be in front or behind at different times. The words can join together some sometimes. Below are some of the samples.
Thanks!
- hnguy71
Super User
Hi joeywong ,
To accomplish this, you'll first need a list of keywords to provide such as this:And then create a custom column to check if the sub-string matches any in the list.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElVitUBsgICfFzBLBUkQRBLwdQUzDE1VUCTSc8vya/KzwcL6CEMALMUVFTAHKB8XmpqSkl+er4CVEksAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Words Pattern" = _t]), // Retrieve list of text strings ListPatterns = List.Buffer(KeywordList), // Find pattern, return first found string, ignoring case-sensitivity. ReturnFoundString = Table.AddColumn(Source, "Extract Words", each List.First( List.Transform( ListPatterns , (n) => if Text.Contains([Words Pattern], n, Comparer.OrdinalIgnoreCase) then n else null ) ) , type text) in ReturnFoundStringExpected Output:
I've included a sample pbix for reference.