*Mark Parnell* wrote:
> On Fri, 23 Jul 2004 08:30:46 +1200, KiwiBrian <>
> declared in alt.html:
>
>> I have a need to remove all comments from html files.
>
> I'm sure it could be done easily with regular expressions, but I'm
> clueless when it comes to them.
Someone else should be able to
> push you in the right direction though.
E.g. Open TextPad, open the 'Find In Files' dialogue, enter
'<!--[^#]?[^--]*-->' minus quotes in the 'Find what' input box, tick
'Regular expression', choose appropriate file type and folder, run
'Find'. In generated results pane, bring up context menu and choose
'Open all'. Open 'Replace' dialogue (CTRL-H), write
'[\t ]*<!--[^#]?[^--]*-->[\t ]*\n?' in the 'Find what' box minus quotes,
tick 'All documents', run 'Replace All'. Check all open documents for
any mis-matches, errors, choose 'save all' menu option in file menu.
Regular expressions delete <!--anything--> but ignore lines with a #
after the comment <!--#anything--> to prevent deleting SSI declarations.
Back-up files before use!
--
Andrew Urquhart
- My reply address is invalid, see
www.andrewu.co.uk/contact/