0
Answer

Picking Sentences with list of words in textbox

Sameer Khan

Sameer Khan

9y
440
1
I have this list of words in TextBox1

????

?????

???

???????

????

???

???

???

and i am trying to pick sentences from richtextbox containing those words. need some help friends.
var regex = new Regex(textBox2.Text);                 List<string> matchingLines = new List<string>();                 foreach (var richBoxItem in targetrichtextBox.ToString())// loop every item in your targetrichtextBox                 {                     string[] texts = targetListBox.Text.Split('?', '?', '\n');                     foreach (var t in texts)                     {                          if (regex.IsMatch(t))                         {                             //matchingLines.Add(targetTextBox2.Text.ToString());                             matchingLines.Add(t.Trim());                             //break;                         }                      }                     break;                 }                 targetTextBox2.Lines = matchingLines.ToArray();