Monday 3 December 2012

Replace/Remove unwanted character using regex

Sometime when we have fileupload that you want to save it to web server there are some anwanted character need to be changed becouse this character can make the download link not work
To change the chararacter use code below

C#
Regex reg = new Regex("[;\\/:*?\"<>|&']");
documentName = reg.Replace(documentName, "-");

No comments:

Post a Comment