开发者

asp.net regex help

Hi ive got this regular expression and that extracts numbers from a string

string.Join(null,System.Text.RegularExpressions.Regex.Split(expr, "[^\\d]"));

so eg, the format of my string is like this strA:开发者_C百科12, strB:14, strC:15

so the regex returns 121415

how can I modify the expression to return 12,14,15 instead, any suggestions please


You're calling String.Join, which joins an array of strings into a single string, separating each element by the separator parameter.

Since you're passing null as that parameter, it doesn't put anything between the strings.

You need to pass ", " instead of null to separate each string with ,.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜