Andrej Andrej - 1 year ago 94
C# Question

regular expression needed to remove C/C# comments

I need a C# regex to delete everything between

/*
and
*/
including the
/**/
.
So, basically remove all code comments in the given text.

Answer Source

Should be something like this:

var regex = new Regex("/\*((?!\*/).)*\*/", RegexOptions.Singleline);

regex.Replace(input, "");