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
I've got a simple expression quesxx where xx is a number from 0 to 99.
I want to replace it with simply ques. That is, I want to remove the
numbers.
Will str_replace do it, or must I use ereg_replace?
I haven't figured out from reading the php manual on regular expression
how to do this
?
- -Oorspronkelijk bericht-
- Van: Al [mailto:[EMAIL PROTECTED]
- Verzonden: dinsdag 9 september 2003 23:21
- Aan: [EMAIL PROTECTED]
- Onderwerp: [PHP] str_replace question
-
-
- I've got a simple expression quesxx where xx is a number
- from 0 to 99.
-
- I want to replace it with simply
?
- -Oorspronkelijk bericht-
- Van: Al [mailto:[EMAIL PROTECTED]
- Verzonden: dinsdag 9 september 2003 23:21
- Aan: [EMAIL PROTECTED]
- Onderwerp: [PHP] str_replace question
-
-
- I've got a simple expression quesxx where xx is a number
- from 0 to 99.
-
- I want to replace
Hello, i have array $reserved_words which i want to replace with bold ..
but when i tried to do str_replace($reserved_words,
b.$reserved_words./b, $string) it showed Array instead of
bword/b
if i simply do str_replace($reserved_words, $reserved_words, $string) then
it shows the words not Array
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
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));
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));
8 matches
Mail list logo