Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. var blockComments = @"/\*(.*?)\*/";
  2. var lineComments = @"//(.*?)\r?\n";
  3. var strings = @"""((\\[^\n]|[^""\n])*)""";
  4. var verbatimStrings = @"@(""[^""]*"")+";
  5.  
  6. string noComments = Regex.Replace(this.codeString, blockComments + "|" +
  7. lineComments + "|" + strings + "|" + verbatimStrings, me => {
  8. if (me.Value.StartsWith("/*") || me.Value.StartsWith("//"))
  9. return me.Value.StartsWith("//") ? Environment.NewLine : "";
  10. return me.Value;
  11. },
  12. RegexOptions.Singleline);
  13.  
  14. this.codeString = noComments;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement