I am developing a Windows application using C #. I am loading a file (html, txt, xhtml) in a text box. I want to check the appearance of the following cases in a text box.
,(comma) with closeup text (ex. text1,text2) .(dot) with closeup text (ex. text1.text2) :(colon) with closeup text (ex. text1:text2) ,(comma) with closeup ' ie (left single quotation mark) "(doublequote) with closeup text '(single quote) with closeup text </i> with closeup text (ex. </i>text) </span> with closeup text.
For all occurrences of the above condition, I want to highlight the specific text found in the text box. I am trying to use regex. I insert all cases into the list of arrays and check one by one. In the first case, if the text in the text field is similar to hjhdf, dfsjf, then it will display a message box, if there is any text before and after this specific text, then it will not display a message.
string regexerror = wordToFind; Regex myregex = new Regex("^[,]*[a-zA-Z]*$"); bool isexist = myregex.IsMatch(rtbFileDisplay.Text); if (isexist) { MessageBox.Show("Hi"); }
source share