Replace function question....

User 528327 Photo


Registered User
7 posts

If i wanted to use the replace function to delete all instances of comments in an html document how would I do this. I tried to put this in the replace function
<!-- * --> but that did not work. Does it have to be the exact comment to be found by the replace function?
User 38401 Photo


Senior Advisor
10,951 posts

Well hmm I was going to open the help file for this to see what it said in there, but it gave me a 404 not found website?
https://www.coffeecup.com/help/articles … d-replace/

I don't see anything that addresses any possible variables we can use when I looked in the PDF help file for CCHE so that didn't help. I've never had a variable work in a search/replace before so I'm not sure if it works in here or not.
User 528054 Photo


Registered User
209 posts

Yes, I would have thought so, any edit or replace function would only do EXACTLY what it was told... with no faffing about.Not easy if there are strings inside that are different...
User 3004957 Photo


Registered User
851 posts

Wildcards used for replacement could be dangerous if set by default but it could be a good idea for an option.

Dave
User 427108 Photo


Registered User
292 posts

Hummmm!!!
I agree with Dave, replacing using an wildcard may be dangerous.
Why not using the "Find" function instead of "Replace" to finde the characteres "<!--" and then delete what you want. It will be a semi-automatic solution...
Jimmy The Sailor
http://www.jimmythesailor.net (trying to show my photos)
http://www.art-i-batik.com (my wife's gallery)
User 6573 Photo


Ambassador
2,649 posts

Wild Card is not a good thing, you might lose important things you might want to keep.

When I create a website - I typically put comments on a line for itself. Plus I usually modify my preferences for comments. In my case it is gray words on a light green background. That way they always stand out and I can easily find them and delete them out if I need to.

You might want to change your comment preferences so that you can see and manually delete them. I know it is not the perfect way, but it might make the job easier.

From Menu > Click Tools > Select Preferences > Click Customization Tab > Click Modified Highlight button > Under Elements Box click Comment >

Be sure the foreground and background box are unchecked and then you can select the colors for those features.

Idea:

It be wonderful if some day CoffeeCup would add a feature that allowed you to delete lines out of code if you had the number lines checked. Maybe a right click on the line number and allowed a copy, delete, paste above or below....

User 427108 Photo


Registered User
292 posts

Hi Kim
Nice tip, thanks a lot
Jimmy The Sailor
http://www.jimmythesailor.net (trying to show my photos)
http://www.art-i-batik.com (my wife's gallery)
User 113629 Photo


Registered User
36 posts

I realize this is a really old post I stumbled across.

I just thought I'd mention that, for as long as I can remember, CoffeeCup has always had the built-in feature to minify HTML pages before uploading. There is no reason to do your own search & replace when CoffeeCup can strip out the comments and extra whitespace automatically.

The key of course, is to have properly formatted markup and preview the page before uploading it.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.