Bug #1514: PCRE - request for s///e
| From: | rns at radar dot no | Date: | Wed, 09 Jun 1999 07:30:26 +0000 |
| Subject: | Bug #1514: PCRE - request for s///e | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6749@lists.php.net to get a copy of this message | ||
From: rns@radar.no
Operating system: RedHat 6.0
PHP version: 3.0.9
PHP Bug Type: Feature/Change Request
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'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