Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var blockComments = @"/\*(.*?)\*/";
- var lineComments = @"//(.*?)\r?\n";
- var strings = @"""((\\[^\n]|[^""\n])*)""";
- var verbatimStrings = @"@(""[^""]*"")+";
- string noComments = Regex.Replace(this.codeString, blockComments + "|" +
- lineComments + "|" + strings + "|" + verbatimStrings, me => {
- if (me.Value.StartsWith("/*") || me.Value.StartsWith("//"))
- return me.Value.StartsWith("//") ? Environment.NewLine : "";
- return me.Value;
- },
- RegexOptions.Singleline);
- this.codeString = noComments;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement