Gets me nowhere with (a); and for (b) $separatedbit = preg_replace ("/^[0-9]+/","",$variable); Gets the numbers off at the begining when there are 2 numbers but does nothing when there is a single digit.
I seem to be managing fine with the rest of PHP it is just the wretched reg exps that are giving me the problem. Everything always seems to work with Perl for me. Perhaps it is because I feel like I may be coming down with a bout of flu.
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? [webmasterworld.com...] If so, are you trying to get the actual text string "buffer", which could be a variable string off the original string as well?
You're right the preg_replace does work. It was a problem with the data! hidden characters! Duh! No wonder I could not get it to work. Thanks. Your help is much appreciated. I got hidden characters in some of my data when writing another piece of code. There won't be any in the finished version.
This is the trouble when you are new at something. It is more easy to assume that you are not doing something that is rather complicated in the correct manner than to assume there is a simpler problem elsewhere.
It is not related to the previous posting except that I learned the method I am using from there and thus there is a similarity.
The word buffer is there to be discarded. Essentially what I am doing is sorting some randomly sorted but numbered data. The easiest way is to tag the numbers on the beginning and do a natsort() on the array.
The word buffer is there to distinguish between 1 2this is the string and 12 this is the string
which become 1buffer2this is the string and 12bufferthis is the string.