SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any ways to remove all the comments from aspx files only in SharePoint Designer? I found that the Optimize HTML in SharePoint Designer only deal with HTML only.

I am also open to any software that is able to help me to remove all the comments from aspx files.

share|improve this question
No. You have to open the files one-by-one and delete the comments. If they aren't accessable through SPD, you have to log onto the server and do the procedure there. – Daniel Ziga Feb 27 '12 at 3:09
@Dandroid, you must be kidding right? I have 50+ files and opening each and every one of them is a pain. – Jack Feb 27 '12 at 6:15
Nope. Good luck, have fun. – Daniel Ziga Feb 27 '12 at 10:33
up vote 2 down vote accepted

The only hope for you is to use Find/Replace command with a robust Regular expression to find the comments and then replace with blank.

I believe SharePoint supports Regular expressions. As an example, I have written an expression that works for simple one line comments as shown below:

enter image description here

The expression I used is:


DISCLAIMER: You need to thoroughly test your regular expression before you perform replace function.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.