Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now

Arrange a string which contain slash(\) keyword in C#


Arrange a string which contain slash(\) keyword in C#

        public static void arrangeString()

        {

 

            string sep = "abc yrr dfr yjr \"fdff fdfd dfdf\" sdf rtr \"dsdfs sfdsf sdfdsf \" sdd";

 

            var re = new System.Text.RegularExpressions.Regex("(?<=\")[^\"]*(?=\") | [^\" ]+");

            var strings = re.Matches(sep).Cast<System.Text.RegularExpressions.Match>().Select(m => m.Value).ToArray();

 

 

            foreach (var item in strings)

            {

                Console.WriteLine(item);

            }

 

            Console.ReadLine();

        }

 Output



Share this

Related Posts

Previous
Next Post »

Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now