Search code examples
regexsublimetext2sublimetext

Regex to remove all comments from CSS file in Sublime Text 2


I am in need of a Sublime Text 2 friendly regex that would allow me to search for all comments within a file.

The comments are all following this basic structure /* <anything> */

Thanks for taking the time to help :)


Solution

  • Something like this should work:

    \/\*.+?\*\/
    

    I'm not super-familiar with Sublime Text, but this would work in Notepad++, and I believe the regex implementation is basically the same. If I'm wrong, feel free to let me know.

    Edit: Per CAustin's helpful tip, you can also just do this (without the escaping of the forward slashes):

    /\*.+?\*/