473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

preg_replace function doesn't work. HELP!

The situation:
root@oasis2# cat test.php ; echo "---------"; php test.php
<?php

$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
?>
---------
PHP Fatal error: Call to undefined function: preg_replace() in
/home/ruslan/oasis/oasis/test.php on line 6
root@oasis2#
Any help is apriciated!

Thanks in advance!

Ruslan

-------------
PHP-4.3.5
FreeBSD-5.4

Jul 17 '05 #1
2 6833
Ruslan V. Sulakov wrote:
The situation:
root@oasis2# cat test.php ; echo "---------"; php test.php
<?php

$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
?>
---------
PHP Fatal error: Call to undefined function: preg_replace() in
/home/ruslan/oasis/oasis/test.php on line 6
root@oasis2#
Any help is apriciated!

Thanks in advance!

Ruslan

-------------
PHP-4.3.5
FreeBSD-5.4


Hi,

Did you compile it yourself?
Maybe you forgot the PCRE extensions??

If so: recompile php and compile the regular expression engine into it.
And when you are busy doing, why not take a newer version?

Good luck.

Regards,
Erwin Moller
Jul 17 '05 #2
Sorry, I forgot to pass a usefull url:

http://nl2.php.net/pcre

Good luck.

Regards,
Erwin Moller
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JDJones | last post by:
I'm having some trouble getting this replacement to work efficiently. I have the following code: $thing = preg_replace("(\r\n|\n|\r|\t)", "", $thing1); What I want to do now is to get it to...
4
by: Sidharta | last post by:
Hi all, how come this doesn't work????? # convert to unix new lines $text = preg_replace("/\r\n/", "\n", $text); # remove extra new lines $text = preg_replace("/\n+/", "\n", $text); is...
7
by: Margaret MacDonald | last post by:
I've been going mad trying to figure out how to do this--it should be easy! Allow the user to enter '\_sometext\_', i.e., literal backslash, underscore, some text, literal backslash, underscore...
2
by: Afkamm | last post by:
Hi, :) The preg_replace function... preg_replace(pattern, replacement, subject ) How on earth do you get the limit value to work with arrays? In my code both the pattern and replacement...
5
by: julianmlp | last post by:
I'm fairly new to regex code, and I'm trying to find a way to replace any text after "///" (three slashes) and before a "\n" character. I've tried with: $filen = preg_replace("///./\n$", "",...
1
by: marcionline | last post by:
I have this regexp to post edonkey links that replace this "#(^|(?<=))(ed2k://\|file\|(+?)\|(\d+?)\|({32})\|(.*?)/?)(?!)(?=(*?)|*?$)#i" to this: <a...
2
by: Gilles Ganault | last post by:
Hello I went through some examples, tried a bunch of things... but still can't figure out why I can't extract the TITLE section of a web page using preg_replace(): ----------- <?php $url...
2
by: Terence | last post by:
I've been puzzling over something for ages and now give up: Does anyone see any problem with any of the following: $line = preg_replace('/\{1,6})\]/i', "<font color='# ${1}'>", $line); ...
1
by: K. | last post by:
Hello! I would like to use preg_replace function to leave in the result variable only: 1) letters from A to Z including Polish letters like ±¶¼³óñê including Polish upper letters like ¡¦¬£ÓÑÊ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.