Question

Like I want to search 'test' from the beginning of the sentence or the end of the sentence, how to make it work? What method should i use? I will type "test" in a textbox, and search in the richtextbox, the sentence is in richtextbox. Thank you for taking your time.

Was it helpful?

Solution

You can use System.Text.RegularExpressions.Regex.IsMatch() to check for certain text string in a larger text string:

if (System.Text.RegularExpressions.Regex.IsMatch("text string including test", "test", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
    //test found
}

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top