Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread skate
> > 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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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; > ?> > ..

Re: [PHP] Using eregi_replace()

2003-08-01 Thread Anthony Ritter
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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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",$

Re: [PHP] Using eregi_replace()

2003-08-01 Thread Anthony Ritter
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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread Marek Kilimajer
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: $

Re: [PHP] Using eregi_replace()

2003-08-01 Thread Curt Zirzow
* 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

Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
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

Re: [PHP] using eregi_replace to replace only substrings -- not the entire string.

2001-08-13 Thread David Robley
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