Sameer Khan

Sameer Khan

  • NA
  • 1
  • 682

Picking Sentences with list of words in textbox

Mar 5 2015 8:14 AM
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();