62,046
社区成员
发帖
与我相关
我的任务
分享
string resultString = null;
try {
resultString = Regex.Replace(subjectString, @"([a-zA-Z]+)\+(\d+)\+(\d+%)", new MatchEvaluator(ComputeReplacement));
} catch (ArgumentException ex) {
// Syntax error in the regular expression
}
public String ComputeReplacement(Match m) {
// You can vary the replacement text for each match on-the-fly
return "";
}
string kk = "ws+5+12%";
Match mt = Regex.Match(kk, @"([^+]*)\+(\d*)\+(\d*%)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
string one = mt.Groups[1].Value; //ws
string two = mt.Groups[2].Value; // 5
string three = mt.Groups[3].Value; //12%