On Thu, May 06, 2004 at 11:48:36PM -0400, Paul Chvostek wrote:
On Thu, May 06, 2004 at 07:11:55PM +, Curt Zirzow wrote:
$text=one !--bleh\nblarg - two\n;
print ereg_replace(!--([^-][^-]?[^]?)*--, ,$text);
Because your missing a -
$text=one !--bleh\nblarg -- two\n;
/me
On Thu, May 06, 2004 at 07:11:55PM +, Curt Zirzow wrote:
$text=one !--bleh\nblarg - two\n;
print ereg_replace(!--([^-][^-]?[^]?)*--, ,$text);
Because your missing a -
$text=one !--bleh\nblarg -- two\n;
/me applies mallet to head
% php -r '$text=one !--bleh\nblarg -- two\n;
Petr, et al --
...and then Petr U. said...
%
% On Thu, 6 May 2004 11:57:45 -0400
% David T-G [EMAIL PROTECTED] wrote:
%
% Am I missing something painfully obvious?
%
% From http://www.php.net/manual/en/pcre.pattern.syntax.php
%
% However, if a quantifier is followed by a question mark,
Michael, et al --
...and then Michael Sims said...
%
% David T-G wrote:
%
% Am I missing something painfully obvious?
%
% www.perldoc.com appears to be unavailable at the moment, but if you have perldoc
% installed, here's an excerpt from the perlre man page:
I do, but I looked in the php
Thanks to everyone who's replied... appears to be quite a tricky one!!
$text = preg_replace('/!--.*--/su','',$text);
Did not work (was too greedy, matched multiple comments)
$text = preg_replace('/!--.*?--/','',$text);
Did not work (needed multiple lines)
$text =
Justin French wrote:
$text = preg_replace('/!--.*--/su','',$text);
Did not work (was too greedy, matched multiple comments)
Just for the record, it should be a capital 'U' for ungreedy. Lowercase
'u' is something else. :)
--
---John Holmes...
Amazon Wishlist:
On Thu, May 06, 2004 at 11:10:17AM -0400, Paul Chvostek wrote:
On Thu, May 06, 2004 at 03:02:16PM +1000, Justin French wrote:
This isn't working:
$text = preg_replace('/!--(.*)--/','',$text);
Can someone advise what characters I need to escape, or whatever to get
it going?
It's
From: Rob Ellis [EMAIL PROTECTED]
you can make the .* less greedy...
$text = preg_replace('/!--.*?--/', '', $text);
You still need an 's' modifier if you want to match multi-line comments. The
dot character won't match newlines unless you use an 's' modifier.
---John Holmes...
--
PHP
Rob, et al --
...and then Rob Ellis said...
%
...
% you can make the .* less greedy...
%
% $text = preg_replace('/!--.*?--/', '', $text);
How does that make it ungreedy? The only thing I see relating question
marks and greediness is that a question mark makes part of a regexp with
a /U
David T-G wrote:
% you can make the .* less greedy...
%
% $text = preg_replace('/!--.*?--/', '', $text);
How does that make it ungreedy? The only thing I see relating
question marks and greediness is that a question mark makes part of a
regexp with a /U modifier (otherwise not greedy)
On Thu, 6 May 2004 11:57:45 -0400
David T-G [EMAIL PROTECTED] wrote:
Am I missing something painfully obvious?
From http://www.php.net/manual/en/pcre.pattern.syntax.php
However, if a quantifier is followed by a question mark, then it ceases to be
greedy, and instead matches the minimum
On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
$text = ereg_replace(!--[^]*--,,$text);
you can make the .* less greedy...
$text = preg_replace('/!--.*?--/', '', $text);
Interesting to know. My preg-foo is limited; I came at PHP from a
background of awk and sed, so
On Thu, May 06, 2004 at 12:47:10PM -0400, Paul Chvostek wrote:
On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
$text = ereg_replace(!--[^]*--,,$text);
you can make the .* less greedy...
$text = preg_replace('/!--.*?--/', '', $text);
Interesting to know. My
* Thus wrote Paul Chvostek ([EMAIL PROTECTED]):
On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
$text = ereg_replace(!--[^]*--,,$text);
you can make the .* less greedy...
$text = preg_replace('/!--.*?--/', '', $text);
Interestingly, from a shell:
$
14 matches
Mail list logo