1

I'm trying to create a search and replace string like this:

src=\"/path/file.jpg\"

into

src=\"http://mysite.com/path/file.jpg\"

By searching for the property src and the equals slash quote. The problem is creating the search string, every time I do it, it becomes a search for

src=\\"/ instead of src=\"/

if property = "src" in this segment, how can I get it to work?

string equalsSlashQuote = "=" + @"\" + "\"";
string search = property + equalsSlashQuote + "/";
string replace = property + equalsSlashQuote + SiteURL + "/";
input = input.Replace(search, replace);

The problem is the \, I even tried adding it as the char code value 92 and it still becomes \\ in the search variable.

4

1 に答える 1