Если я понял ваш вопрос, вы хотите найти ключевое слово в текстовом файле на основе пользовательского ввода, чтобы что-то сделать, хорошо. Это небольшой фрагмент, чтобы дать вам пример и хорошую отправную точку.
Отрывок
Dim reader As StreamReader
Dim txtInput as String = "YOUR_TXT_FILE_PATH"
'The reader opens the txt input specified with the file path
reader = My.Computer.FileSystem.OpenTextFileReader(txtInput)
'Create a string from the txt file
Dim txtString as String = reader.ReadLine.TrimStart
Dim wordFound as String
'Use Regex inside a Try/Catch statement in order to catch any possible exception.
'If Regex.Match doesn't find your TextBox1.Text inside the string it will throw an exception
Try
'Use Regex to find your word or your expression inside the string created before
For Each data As Match In Regex.Matches(txtString, TextBox1.Text)
wordFound = txtString.Substring(data.index, TextBox1.Text.Lenght())
'Do your stuff with your word found in the txt...
Next
Catch ex As Exception
Err.Clear()
Finally
'Close the reader before the Try/Catch statement
reader.Close()
End Try
Я предлагаю вам сначала прочитать документацию о Regex.Match и, если у вас есть какие-либо сомнения, не стесняйтесь спрашивать.
Добро пожаловать в StackOverflow!