On Fri, Aug 01, 2003 at 04:51:38PM +0100, skate wrote:
> >
> > you could also use different delimiters and write for example:
> > '/.*?(hello.*going).*/' or '[.*?(hello.*going).*]' the regular
> > expression itself is merely ".*?(hello.*going).*" which matches the
> > whole string and replaces it b
>
> you could also use different delimiters and write for example:
> '/.*?(hello.*going).*/' or '[.*?(hello.*going).*]' the regular
> expression itself is merely ".*?(hello.*going).*" which matches the
> whole string and replaces it by the first matching expression
> sourrounded in by ()s (thats th
On Fri, Aug 01, 2003 at 11:36:29AM -0400, Anthony Ritter wrote:
> However, this works using:
> preg_replace()
>
> .
>
> $text="blah blah blah hello I must be going blah blah";
> $newtext= preg_replace("!.*?(hello.*going).*!","$1",$text);
> echo $newtext;
> ?>
> ..
However, this works using:
preg_replace()
.
Thank you all.
Is there a way I can be sure of the syntax?
"!.*?(hello.*going).*!", // the pattern which - I think - reads as follows:
!.*? //
do not use any character or characters before the grouping of hello
On Fri, Aug 01, 2003 at 05:13:05PM +0200, Marek Kilimajer wrote:
> And besides ereg_replace would not work becase it's greedy, .* would
> match "going", than "going" would not be found and the whole match would
> fail.
nope, it would backtrace then. but the first .* ist greedy so it would
match
On Fri, Aug 01, 2003 at 11:25:07AM -0400, Anthony Ritter wrote:
> Messju Mohr" <[EMAIL PROTECTED] writes:
>
> > you mean
> > $newtext= ereg_replace(".*?(hello.*going).*","\\1",$text);
> > ??
> ..
>
> Thank you but I get:
>
> Warning: REG_BADRPT: in c:\apache\htdoc
On Fri, Aug 01, 2003 at 03:13:53PM +, Curt Zirzow wrote:
> * Thus wrote messju mohr ([EMAIL PROTECTED]):
> > On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
> >
> > i would suggest preg_replace in favour to ereg_replace:
> > $newtext= preg_replace("!.*?(hello.*going).*!","$1",$
Messju Mohr" <[EMAIL PROTECTED] writes:
> you mean
> $newtext= ereg_replace(".*?(hello.*going).*","\\1",$text);
> ??
..
Thank you but I get:
Warning: REG_BADRPT: in c:\apache\htdocs\string.php on line 3
Using:
.
Regards,
TR
And besides ereg_replace would not work becase it's greedy, .* would
match "going", than "going" would not be found and the whole match would
fail.
messju mohr wrote:
you mean
$newtext= ereg_replace(".*?(hello.*going).*","\\1",$text);
??
i would suggest preg_replace in favour to ereg_replace:
$
* Thus wrote messju mohr ([EMAIL PROTECTED]):
> On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
>
> i would suggest preg_replace in favour to ereg_replace:
> $newtext= preg_replace("!.*?(hello.*going).*!","$1",$text);
Doesn't the $1 need to be escaped or in single quotes so php
do
On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
> Using eregi_replace(), is there a way to take out a piece of a sentence -
> which has spaces - and then return the new sentence?
>
> For example, to return the new sentence:
>
> hello I must be going
>
> from the original sentence
Using eregi_replace(), is there a way to take out a piece of a sentence -
which has spaces - and then return the new sentence?
For example, to return the new sentence:
hello I must be going
from the original sentence:
blah blah blah hello I must be going blah blah.
I tried:
...
On Tue, 14 Aug 2001 12:23, Kurt Lieber wrote:
> I'm trying to update a number in a text file using eregi_replace.
>
> The original line is:
>
> $registrationLimit = 100;
>
> and I'd like to change it to:
>
> $registrationLimit = 300;
>
> now, 100 appears multiple times throughout the file, so I ha
I'm trying to update a number in a text file using eregi_replace.
The original line is:
$registrationLimit = 100;
and I'd like to change it to:
$registrationLimit = 300;
now, 100 appears multiple times throughout the file, so I have to match
on the whole string, not just 100. I used the fo
14 matches
Mail list logo