--- Justin French <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> This isn't working:
> $text = preg_replace('/<!--(.*)-->/','',$text);
> 
> Can someone advise what characters I need to escape,
> or whatever to get 
> it going?
> 
> TIA
> 
> ---
> Justin French
> http://indent.com.au
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Hi, 

You must escape "-" (minus sign) because is a
meta-character for regular expressions. See 
http://www.php.net/manual/en/pcre.pattern.syntax.php.
Your line of code might be:

<CODE>
$text = preg_replace('/<!\-\-(.*)\-\->/','',$text);
</CODE>

This line of code, if you are parsing HTML file row by
row, strips only "one line" comments. Comments spanned
on multiple lines are unaffected.
 
HTH

Marius


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to