Forum Discussion
Extraction with Text Between Delimiters not working
- 5 years ago
As I suspected data123 - those aren't spaces. Look at this:
The character after the Y in Ashley's name is a space - ASCII code 32.
The characters after the S in her last name is char 63 and char 160. Char 160 is an HTML non-breaking space. 63 is a quesion mark, which isn't showing. It is because in reality it is a high ASCII non-printable character. I can select it and copy/paste it, but as you can see below, I cannot see it. Excel cannot see it properly either which is why it reports it as 63. But Power Query can. It is ASCII character 8203 which is being inserted by your software.
So visually you and I see a space after "hodges" but Power Query sees that invisible character, plus the non-breaking space (ASCII 160)
So I added to Replace statements after the initial import, and before the Text.BetweenDelimiters function:
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Replaced Value" = Table.ReplaceValue(Source,Character.FromNumber(8203),"",Replacer.ReplaceValue,{"ETL"}), #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",Character.FromNumber(160)," ",Replacer.ReplaceText,{"ETL"}), #"Added Custom" = Table.AddColumn(#"Replaced Value1", "Custom", each Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1)) in #"Added Custom"Likely only the 2nd one is needed - it will replace all non-breaking spaces with a space (160 to 32) then Text.BetweenDelimiters works.
I was doing some testing, so you can replace:
Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1)with
Text.BetweenDelimiters([ETL], "@", " ", 0, 1)It is the same thing.