How to replace and split a string having "|","$","^" as delimiter using Regex in C#?

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 369
using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
new Regex(@"[|$^]+")
.Replace("RNATeam|Rajlaxmi$Niladri^Arina", "*") //replacing with *
.Split('*') //split with *
.ToList()
.ForEach(i => Console.WriteLine(i));
}
}
}


Output
--------


RNATeam
Rajlaxmi
Niladri
Arina

Comments or Responses

Login to post response