preg_replace('/*\[a-z]+)[0-9]+(\)/', '$1$2', $String);
Ok why not simply use reg_replace('/ques[0-9][0-9]/', '/ques/', $String);
BTW preg regex are more powerfull since they support some stuff that the
posix standard does not support. As far as I know lookbehinds and
lookbacks and stuff like
$String = ques99;
preg_replace('/*\[a-z]+)[0-9]+(\)/', '$1$2', $String);
will most likeley do.
Btw, does anybody know why preg_replace is adviced over ereg_replace in the
manual? .. and if ereg_replace doesn't have any advantages over
preg_replace, couldn't this function get depricated?
-
I think (and don't quote me on this, and feel free to correct me :) that
preg_replace() is fast being based on perl regular expressions.
ereg_replace() however, follows the POSIX standard for regular
expression matching.
Cheers,
Rob.
On Tue, 2003-09-09 at 17:36, Wouter van Vliet wrote:
$String
preg_replace('/\d+/','',$the_string);
Hope this helps.
Andrey
- Original Message -
From: Andras Kende [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 16, 2002 4:29 AM
Subject: [PHP] str_replace question
Is a nicer way to remove any number 1-0 from a string???
Andras Kende [EMAIL PROTECTED] wrote:
Is a nicer way to remove any number 1-0 from a string???
Currently:
$metakeywords=str_replace(1,'',strtolower($metakeywords));
$metakeywords=str_replace(2,'',strtolower($metakeywords));
$metakeywords=str_replace(3,'',strtolower($metakeywords));
5 matches
Mail list logo