From John:
$new_number = preg_replace('/^'.$this->start_num.'([0-9]+)'.$this->end_num.'$/',
'\\1',$old _number);
The one that Mike gave didn't seem to do anything, John's will work if it can match the beginning and the end successfully. I should probably explain myself further.
Sometimes there won't be anything to replace at the front, and sometimes nothing at the end. So it'd still need to do the front and/or end wether or not they both exist.
Is there a way to tweak these to do that?
Should be:
$new_number = preg_replace( '/^('.$this->start_num.')?([0-9]+)('.$this->end_num.')?$/', '\\2', $old _number);
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php