title: vb.net how to check if a string has a certain word
body: <p>i want to check if a string matches a word in array not just matches characters. the contains method just checks the matches characters not the whole word. here is my code:</p>
  
  <pre><code> Dim builder As New StringBuilder()
      Dim reader As New StringReader(txtOCR.Text)
      Dim titles() As String = {"the", "a", "an", "of"}
      Dim regex As New Regex(String.Join("|", titles), RegexOptions.IgnoreCase)
  
      While True
          Dim line As String = reader.ReadLine()
          If line Is Nothing Then Exit While
          Dim WordCount = New Regex("\w+").Matches(line).Count
  
          If WordCount = 1 And Not line.ToLower().Contains("by") Then
              builder.AppendLine(line)
          ElseIf regex.IsMatch(line) Then
              builder.AppendLine(line)
          End If
  
      End While
      txtTitle.Text = builder.ToString()
  </code></pre>