Nam Vo
Nam Vo

Reputation: 159

how to remove "\'"?

I'm trying to remove \' from an string

 string temp = "[['90\'','','Delay in match Cédric Kanté (Sochaux) because of an injury.','away']]";

 temp = Regex.Replace(temp, @"\\'", "");  >> still have ' mark  [['90'','','...']

I've tried many ways but failed.

Thanks

Upvotes: 0

Views: 69

Answers (2)

L.B
L.B

Reputation: 116108

It is in a form that can be parsed by json serilaizers. No need for Regex.

string temp = @"[['90\'','','Delay in match Cédric Kanté (Sochaux) because of an injury.','away']]";

var js = new JavaScriptSerializer();
List<List<string>> listOfList = js.Deserialize<List<List<string>>>(temp);

foreach (var item in listOfList[0])
    Console.WriteLine(item);

Upvotes: 0

techfoobar
techfoobar

Reputation: 66663

You should be able to do: .Replace(temp, @"\\", "");

Upvotes: 1

Related Questions