THANK YOU!
Quote:
Regex.Replace(string.format("({0})", Regex.Escape(input)), "<b>$1</b>", RegexOptions.IgnoreCase)
Presuming
user search input : textboxSearch.text
replace is : "<b>"+textboxSearch.text+"</b>"
data I'm looking to impact is : Research.Text (a gridview row label
control)
How would I use the above?
I tried:
Imports System.Text.RegularExpressions
Research.Text = Regex.Replace(String.Format("({0})",
Regex.Escape(textboxSearch.Text)), "<b>$1</b>",
RegexOptions.IgnoreCase)
Getting an error on Regex.Replace : Reference to a non-shared member
requires an object reference.
So I noticed it appears to be formated incorrectly and probably should
be :
Research.Text = Regex.Replace(String.Format("({0})"),
Regex.Escape(textboxSearch.Text), "<b>$1</b>",
RegexOptions.IgnoreCase)
However that did not work.
I also tried:
No effect:
Research.Text = Regex.Replace(String.Format("({0})"),
Regex.Escape(textboxSearch.Text), "<b>$1</b>",
RegexOptions.IgnoreCase)
replaces string with actually "$1":
'Research.Text = Regex.Replace(Research.Text,
Regex.Escape(textboxSearch.Text), "<b>$1</b>",
RegexOptions.IgnoreCase)
works, in finding the strings, but replaces with wrong case:
'Research.Text = Regex.Replace(Research.Text,
Regex.Escape(textboxSearch.Text), "<b>"+ textboxSearch.Text+"</b>",
RegexOptions.IgnoreCase)
Thanks again.