[EMAIL PROTECTED] wrote:
Then change :
127.0.0.1 localhost
become :
157.47.115.180 [my_server_name]
Changing this line is probably not the best way. This file is used for
resolving the hostnames ti ip adresses. So a better way would probably
be adding the line to the
Is there a command in PHP that is equal to the search replace function
in a word processor?
If I want to search for 'this' and replace it with 'that' what would the
syntax be?
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ron Piggott (PHP wrote:
Is there a command in PHP that is equal to the search replace function
in a word processor?
If I want to search for 'this' and replace it with 'that' what would the
syntax be?
Ron
Look for str_replace().
--
---
try this :
$date = 30/12/1982 15:30
if (preg_match(/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i,$date )) {
echo Date is valid;
} else {
echo Date NOT valid;
}
hope it will help you
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If you want to have more control on searching and replacing in PHP,
try Regular Exprssion. I myself prefer PERL compatible regular
expression, because is little bit more easy than its POSIX sibling.
try preg_match(), pref_replace() etc.
There is many tutorial about PERL Regex Syntax on the net
Try this link for PERL regex reference :
http://www.perl.com/doc/manual/html/pod/perlre.html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Thursday 30 March 2006 16:49, Arie Nugraha wrote:
try this :
$date = 30/12/1982 15:30
if (preg_match(/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i,$date )) {
echo Date is valid;
} else {
echo Date NOT valid;
}
This is not correct since you don't check the ranges of the day digits, month
Petar Nedyalkov ha scritto:
This is not correct since you don't check the ranges of the day digits, month
digits, etc.
The easiest way to check the string is to explode it by (space), then
explode the first part by slash and the second by column, and at last check
the ranges.
A regular
Thanks so much, Constantin...
Regards,
Anita
-Original Message-
From: Constantin Wolber [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 5:44 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Cannot connect to MySQL using
[EMAIL PROTECTED] wrote:
Then change :
Hi,
this regex isn't perfect at all but might do the job. You should
modify the pattern to match the year part against 2037 as a maximum
and also don't forget to checkdate().
?php
$date = '30/03/2983 12:00';
$pattern = '[0-3][0-9]/[0|1][0-9]/[1|2][0-9]{3,3}\s[0-2][0-9]:[0-5][0-9]';
Oops, \s matches any whitespace character, so if you need only space
there you should change \s to space (this way it matches tab too).
Balazs
2006/3/31, Balazs Hegedus [EMAIL PROTECTED]:
Hi,
this regex isn't perfect at all but might do the job. You should
modify the pattern to match the
11 matches
Mail list logo