Hello,
I would like extract a part of a sentence around a key word.
For example:
Input:
1. John wants to buy 5 apples today in the market.
2. There are three apples in the fruit bowl.
3. The red apples fell from the tree.
Output:
1. buy 5 apples today in
2. are three apples in the
3. The red apple fell from
Sometimes there could be a number before the term apple or a full word, but ideally I would like to extract 2 either words or numbers (a number with multiple digits should cound as one number) and 2 words after and of course include the word apples.
Thanks in advance,
Joseph
Solved! Go to Solution.
People with more skill can probably make this neater, but this seems to work:
\<\w+\>\s\<\w+\>\sapples\s\<\w+\>\s\<\w+\>
Hi Meagan,
I tried what you suggested but got the following error:
Thanks,
Joseph
This is what I have:
There might be a better way, but 'm putting the section we want into a new column then removing the whitespace and selecting only that column
Thanks Simha! This seems to work.