none
Remove text from string RRS feed

  • Question

  • All,

    Very new to Power Query, yet I'm trying to accomplish something very simple.

    I have rows of the following:

    2.0 USB Device/USBSTOR\DISK&VEN_2.0&PROD_&REV_5.00\2713390024717703&0

    CBM Flash Disk USB Device/USBSTOR\DISK&VEN_CBM&PROD_FLASH_DISK&REV_5.00\021007005895CB01&0

    I've many more too.

    How can I do a wild card find and replace so

    2.0 USB Device/USBSTOR\DISK&VEN_2.0&PROD_&REV_5.00\2713390024717703&0 = 2.0 USB Device

    CBM Flash Disk USB Device/USBSTOR\DISK&VEN_CBM&PROD_FLASH_DISK&REV_5.00\021007005895CB01&0 = CBM Flash Disk USB Device

    Thanks

    Friday, October 21, 2016 12:28 PM

Answers

  • let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        ChangedType = Table.TransformColumnTypes(Source,{{"Text", type text}}),
        TransformedColumn = Table.TransformColumns(
                                                    ChangedType,
                                                   {{"Text", each Text.Start(_,Text.PositionOf(_,"/"))}}
                                             )
    in
        TransformedColumn

    Where "Text" is the name of the column being modified.



    Friday, October 21, 2016 3:33 PM