From: "Justin French" <[EMAIL PROTECTED]> > This isn't working: > $text = preg_replace('/<!--(.*)-->/','',$text); > > Can someone advise what characters I need to escape, or whatever to get > it going?
$text = preg_replace('/<!--.*-->/su','',$text); The 's' modifier will allow the expression to pick up multi-line comments by allowing the dot character to match newlines and the 'u' modifier makes it 'ungreedy', so that if you have <!-- comment 1 --> HTML example <!-- comment 2 --> only the comments themselves are matched and not everything from the first "<!--" to the last "-->". ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php