I need to filter a bit of constantly changing, but similar garbage text from a query source. The junk text always takes the following form:

X?* <- where * is a wildcard and "X?" is the literal string. For example "X?h" or "X?,"

Is there a way to search for the X? portion, and remove all 3 unwanted characters?

2 Answers 2


The goal was to remove only these three characters, which occur at arbitrary positions in the middle of the text. Because the data I am working with is in strict fixed columnar widths, Splitting at these characters would invalidate data in subsequent rows.

The answer I was given is as follows:

//    #"Garbage" = Table.TransformColumns(#"Cleaned Text", {"Column1", each try Text.RemoveRange(, Text.PositionOf(, "X?"), 3) otherwise _}),


Do you want to remove everything after "X?"? If so, you can split the column by delimiter with the custom delimiter X? and then remove the second column. You can split the column by clicking on the column, going to the Transform tab, and choosing Split Column | By Delimiter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.