Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

preg_replace not supported in CSWS_PHP0102?

Dieter Rossbach
Regular Advisor

preg_replace not supported in CSWS_PHP0102?

I took this from the php manuals:

# Display the header
echo " Testing the preg_replace () function

$patterns = array ("/(19|20)(\d{2})-(\d{1,2})-(\d{1,2})/",


$replace = array ("\\3/\\4/\\1\\2", "$\\1 =");

print preg_replace ($patterns, $replace, "{startDate} = 1999-5-27");

when I run it, I get:

Testing the preg_replace () function

Fatal error: Call to undefined function: preg_replace() in /sys_dr/public_html/test.php on line 14

The same happens with other preg functions.
Do I have to load an additional module?

Craig A Berry
Honored Contributor

Re: preg_replace not supported in CSWS_PHP0102?

The docs here:


state that preg_replace is present in all versions of PHP 4, and the kit you have claims to be based on 4.1.1. So it seems to me it should be there.

I think the next step would be to either download the source code from


and try to track down how this got omitted from the hp kit, or, if you have a support contract, log a call and get hp support to do that for you.
Dieter Rossbach
Regular Advisor

Re: preg_replace not supported in CSWS_PHP0102?

The source code helped, thank you:

the extention php_pcre.exe has to be activated in php.ini

Now it works

Thank you