KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I remove all comments and blank lines from a C# source file. Have in mind that there could be a nested comments. Some examples: string text = @"//not a comment"; // a comment /* multiline comment */ string newText = "/*not a comment*/"; // a comment /* multiline // not a comment /* comment */ string anotherText = "/* not a comment */ // some text here\"// not a comment"; // a comment We can have much more complex source than those three examples above. Can some one suggest a regex pattern or other way to solve this. I've already browsed a lot a stuff over the internet and coudn't find anything that works.
Tags (comma-separated)
Save Edits
Cancel