I am trying to remove javascript comments (//
and /**/
) from sting with C#.
Does anyone have RegEx for it. I am reading list of javascript files then append them to string and trying to clean javascript code and make light to load. Bellow you will find one of the RegEx that works fine with /* */
comments but I need to remove //
comments too:
content = System.Text.RegularExpressions.Regex.Replace(content,
@"/\*[^/]*/",
string.Empty);