Using Regex to remove css comments

后端 未结 4 1065
执念已碎
执念已碎 2021-01-23 16:56

How can I remove comments from CSS using Regex.Replace()?

Note - I\'m not able to use the regex mentioned here in C# - Regular expression to remove CSS comm

4条回答
  •  天命终不由人
    2021-01-23 17:52

    I wonder if the following version of Maxim's solution would be faster.

    "/\*[^*]*.*?\*/"
    

    As the discussion shows this will also eliminate comments within string literals.

提交回复
热议问题