Monday, July 13, 2009

Regex - remove special char

string sourceStr = @"Test, Hsr 156-1, "; //Specify all the SP Characters you want to removestring rgPattern = @"['*,]"; Regex oRegex = new Regex(rgPattern); //string rgPattern = @"['\\\/:\*\?""<>,]"; MessageBox.Show(oRegex.Replace(sourceStr, ""));

Hope this helps

No comments:

Post a Comment