coopster - 1:59 pm on Dec 1, 2003 (gmt 0)
Assuming $variable in your example refers to the text string:
$variable = "123buffersome more text that may have numbers in it.";
You forgot to provide the matches parameter on your preg_match. I also added the + quantifier to grab 1 or more digits:
// preg_match("/[0-9]/", $variable); // <-- forgot matches parameter!
preg_match("/[0-9]+/", $variable, $matches);
And the preg_replace works fine as is, whether the text string contains 1 digit or more. Unless I am misunderstanding something here? Is this relative to the following post, neiljones?
If so, are you trying to get the actual text string "buffer", which could be a variable string off the original string as well?