RegEx pour remplacer des caractères spéciaux dans une chaîne avec un espace? asp.net c #

ssortingng inputSsortingng = "1/10 EP Sp'arrowha?wk XT R;TR 2.4GHz Red"; //Characters Collection: (';', '\', '/', ':', '*', '?', ' " ', '', '|', '&', ''') ssortingng outputSsortingng = "1 10 EP Sp arrowha wk XT R TR 2.4GHz Red"; 

Divulgation complète concernant le code suivant:

  • Ce n’est pas testé
  • J’ai probablement bousillé le personnage qui s’échappait dans le new Regex(...) ;
  • Je ne connais pas vraiment C #, mais je peux utiliser Google pour "C# ssortingng replace regex" et atterrir sur MSDN.

     Regex re = new Regex("[;\\/:*?\"<>|&']"); string outputString = re.Replace(inputString, " "); 

Voici le code correct:

 ssortingng inputSsortingng = "1/10 EP Sp'arrowha?wk XT R;TR 2.4GHz R\\ed"; Regex re = new Regex("[;\\\\/:*?\"<>|&']"); string outputString = re.Replace(inputString, " "); // outputString is "1 10 EP Sp arrowha wk XT R TR 2.4GHz R ed" 

Démo: http://ideone.com/hrKdJ

Aussi: http://www.regular-expressions.info/

 ssortingng outputSsortingng = Regex.Replace(inputSsortingng,"[;\/:*?""<>|&']",String.Empty)