Basic things to be understood in
RegEx: "*" matches 0 or more patterns- "?" matches single character
- "^" for ignoring matches.
- "[]" for searching range patterns.
public static void ReverseString() { string s = "XyZ, AB,CC, D"; Regex regex = new Regex(@" |, "); foreach (string sub in regex.Split(s)) { Console.WriteLine("Word: {0}", sub); } }
How to call
static void Main(string[] args) { ReverseString(); Console.ReadLine();
Output