How to extract Words from Text that Contains a Given String?

I’m a bit late here but I feel like regex may be a bit too much here. I would instead suggest using a LINQ query.

If you have your text as text, then you can easily do text.Split(' ').Where(x => x.Contains("fo") || x.Contains("in")) to grab all of the words.

3 Likes