Donate

Remove Open And Close Square Brackets In A Sentence Using Regular Expression In C#

Given the sample string data [Posted Friday September 23 2011] and you need format the sentence like this Posted Friday September 23 2011 without the square brackets, a solution would be to use Regex.
string date = Regex.Replace(date, "[\\[\\]]", string.Empty);  
date = Regex.Replace(date, @"[\[\]]", string.Empty); 

Comments

Post a Comment

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Bootstrap Modal In ASP.NET MVC With CRUD Operations