The following console app works fine:
class Program
{
static void Main(string[] args)
{
string plainx = "‘test data’ random suffix";
plainx = Regex.Replace(plainx, @"‘", string.Empty);
Console.WriteLine(plainx);
}
}
However its giving me trouble in an ASP.Net application.. I am attaching a screenshot of the VS Debug watch window and Immediate window
As you can see, the Regex.Replace
in the Immediate Window
works - but somehow it is not working in the code (line 71). I've also used String.Replace
without success.
Edit It seems the value that was stored in the DB is something than what the editor shows... kind of weird..
The single quote in your code is not the same single quote in the string you are testing.
Use the hex value returned from
testx[0]
directly to guarantee that we are using the correct quote.