Re: Bug #1514: PCRE - request for s///e

From: Date: Wed, 09 Jun 1999 13:48:26 +0000
Subject: Re: Bug #1514: PCRE - request for s///e
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-6764@lists.php.net to get a copy of this message
rns@radar.no wrote: > Bug description: PCRE - request for s///e > > First of all, thanks for a nice fature. > > I've been playing with preg_replace(PATTERN, REPLACE, SUBJECT) and find it very usefull, > but I miss the s/PATTERN/FUNCTION/e from Perl. > > I would like to do something like this: > <?php > $tmp = "one two three"; > echo preg_replace("/(two)/", strrev("\\1"), $tmp); > ?> > > BTW, this example get's a SEGFAULT > FATAL: emalloc(): Unable to allocate 271313254 bytes > httpd: [Wed Jun 9 10:22:17 1999] [notice] child pid 4235 exit signal Segmentation fault (11) I'll take a look at this. > I've looked at the pcre.sgml, but can't find anything that can help me. > Execution for a function works, but that doesn't help me as long I can't use matches from > the regexp. Is it possible to pass \\1 as a variable to a function? > > Rune Nordbøe Skillingstad No, it's not possible to do that. Instead, use preg_match() to get the match you need and pass that to a function. -Andrey * 2 + 2 = 5 for extremely large values of 2. *

« previous php.dev (#6764) next »