Home:ALL Converter>How to write a Regex pattern for the following string?

How to write a Regex pattern for the following string?

Ask Time:2012-08-25T02:11:47         Author:Amir

Json Formatter

I am trying to write a Regex pattern to modify the caption of my datagridview. I need to remove following characters from each string: space [ ] * # ? / \ @ ( ) . "" '' I am super confused and I need your help in defining the patter of the Regex in C#. This is my sample code:

DataTable d_new = d;
for (int i = 0; i < d.Columns.Count; i++)
{
    string t = d.Columns[i].Caption;
    string regex = "\\s+"; // this needs to Be expanded
    string t_new = Regex.Replace(t, regex, "_");
    d.Columns[i].Caption = t_new;
}

Author:Amir,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12114598/how-to-write-a-regex-pattern-for-the-following-string
L.B :

var invalidChars = new HashSet<char>(@\"[]*#?/\\@()\");\nvar output = new string( input.Where(c => !invalidChars.Contains(c)).ToArray() );\n",
2012-08-24T18:19:24
sQVe :

This would match what you want, just replace with an empty string or what you want.\n\n[ \\[\\]*#?/\\\\@().\"']\n\n\nBut in this case an regex is a bit overkill, you could just use Remove.",
2012-08-24T18:16:39
yy