How can omit HTML tags while replacing?
-
Hello, I have a webBrowser control on my windows form. I also have a textBox, in which I allow my user to enter a letter of a word and hit a button to highlight all the occurances of the entered letter/word. Here's the button code: webBrowser1.Document.Body.InnerHtml = webBrowser1.Document.Body.InnerHtml.Replace(textBox1.Text, "<font color=\"red\">" + textBox1.Text + "</font>"); The problem is, if the user enters 'a', for instance, every single 'a' will be replaced and that's a huge problem. Imagine I have: <a href="url">link</a>! And maybe it gets worse if he enters: < or >. How can I solve this? Thanks in advance.
-
Hello, I have a webBrowser control on my windows form. I also have a textBox, in which I allow my user to enter a letter of a word and hit a button to highlight all the occurances of the entered letter/word. Here's the button code: webBrowser1.Document.Body.InnerHtml = webBrowser1.Document.Body.InnerHtml.Replace(textBox1.Text, "<font color=\"red\">" + textBox1.Text + "</font>"); The problem is, if the user enters 'a', for instance, every single 'a' will be replaced and that's a huge problem. Imagine I have: <a href="url">link</a>! And maybe it gets worse if he enters: < or >. How can I solve this? Thanks in advance.
You could use a regular expression to do the pattern matching.
only two letters away from being an asset