Strip out C Style Multi-line Comments

Posted by Olaseni on Stack Overflow See other posts from Stack Overflow or by Olaseni
Published on 2010-03-29T13:43:39Z Indexed on 2010/03/29 14:03 UTC
Read the original article Hit count: 280

Filed under:
|
|

I have a C# string object that contains the code of a generic method, preceded by some standard C-Style multi-line comments.

I figured I could use System.Text.RegularExpressions to remove the comment block, but I can seem to be able to get it to work.

I tried:

code = Regex.Replace(code,@"/\*.*?\*/","");

Can I be pointed in the right direction?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex