split text using regular expresions
Published: 24. October 2011 | Updated: 26. October 2011License: Microsoft Public License (MS-PL)
Categories: Framework » Regex
Tags: C# Regex Text
Import namespace
using System.Text.RegularExpressions;
Code
string input = "abc-def;ghi+jkl"; string pattern = @"[;\-\,\+]"; string[] splitted = Regex.Split(input, pattern); foreach (string item in splitted) { Console.WriteLine(item); }Console Output:
abc
def
ghi
jkl
def
ghi
jkl
| Send us feedback about this snippet » |





