Removing comments from code in Sublime Text

To quickly and easily remove all unwanted comments when using Sublime text, perform a search and replace (CMD, ALT & D) and enter the following. Make sure that regex search is enabled by clicking the small icon in the bottom left that looks like an astrix.

(?s)<start tag>.*?<end tag>

For example, to remove all HTML comments:

(?s)<!--.*?-->

Or to remove all CSS comments:

(?s)/*.*?*/

Comments