Forum Discussion

Cream_17's avatar
Cream_17
Frequent Visitor
3 years ago
Solved

How to split with space except one word

Hello everyone, I`m newbie in this forum, so I`m so sorry if I'm still not used to the way of communication in this forum.

 

【So the problem which  I want to discuss is】

→I need to separate/split the given sentence into single word by "space", but I don`t want the same treatment applied to any phrase begin by word "not"

 

【Exemple】

 

【Desired output】

the AC is not working : (the) (AC) (is) (not working)

the motor is not going well : (the) (motor) (is) (not going) (well)

 

I really appreciate to anyone who can help me solve the problem

  • You can apply steps below after your last step.

     

        Replaced = Table.ReplaceValue(PreviousSteName,"not ","not_",Replacer.ReplaceText,{"commentar"}),
        Split = Table.TransformColumns(Replaced, {{"commentar", each Text.Replace( "(" & Text.Combine( Text.Split (_, " "), ") (") & ")", "_", " "), type text}})
    in
        Split

     

     

2 Replies

  • Cream_17's avatar
    Cream_17
    Frequent Visitor

    Dear Jakinta

     

    Thanks for you response, you solved my problem

  • Jakinta's avatar
    Jakinta
    Solution Sage

    You can apply steps below after your last step.

     

        Replaced = Table.ReplaceValue(PreviousSteName,"not ","not_",Replacer.ReplaceText,{"commentar"}),
        Split = Table.TransformColumns(Replaced, {{"commentar", each Text.Replace( "(" & Text.Combine( Text.Split (_, " "), ") (") & ")", "_", " "), type text}})
    in
        Split