简体   繁体   中英

How to replace single quote in asp.net c#

I used Regex.Replace(jobdesc, @"[^\\/\\'-]+", " "); but its not working please help me I want to replace only (' and -) with blank space how to arrange this regex code.

您可以使用一个简单的替换,如:

"your sentence".Replace("''"," ").Replace("-"," ");

Using Reg Exp you can do as below

string pattern = @"\-\'";
    string input = "mynam-'is";
    string replacement = " ";
    Regex rgx = new Regex(pattern);
    string result = rgx.Replace(input, replacement);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM