Justin --

...and then Justin French said...
% 
% Hi,

Hi!


% 
% This isn't working:
% $text = preg_replace('/<!--(.*)-->/','',$text);
% 
% Can someone advise what characters I need to escape, or whatever to get 
% it going?

Well, what do you want it to do?  On my system that properly replaces the
entire commented string with nothing.  An example which puts something
else there instead:

  <?php

  $text = "<body>\n<h1>Hi</h1>\n<!-- foo --></body>\n" ;
  $text = preg_replace('/<!--(.*)-->/','blah',$text) ;
  print "text is .$text.\n";

  ?>

This yields

  text is .<body>
  <h1>Hi</h1>
  blah</body>
  .

as expected.

Note that since you're just replacing the entire comment with '' you
needn't bother with the () around whatever may be in the middle, too.


% 
% TIA
% 
% ---
% Justin French
% http://indent.com.au


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgpVphnFfsLba.pgp
Description: PGP signature

Reply via email to