Hi,
I want to pick starting two words from the sentence if in a sentence have a word then also pick one word . Please advise.
I used to picked below regex however not working. single word not picking.
Thanks,
Hi @Srawat,
I'm not a massive RegEx guy but I think this should works. It'll tokenize on the first two words or the whole thing if only one word to one new column. The expression I've used is .*?\s.*?\s|.*
@Srawat
Find in attachement one way of doing that using Regex.
Let me know if this answer is ok for you issue or not.
Before
After
Here's an alternative with regular string functions, rather than RegEx. We first perform a check for the number of words and if it's above 1 then we return the first + the second. If the number of words in the string is 1, we just take it as is: