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: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 theseparatorparameter.Since you’re passing
nullas that parameter, it doesn’t put anything between the strings.You need to pass
", "instead ofnullto separate each string with,.