RE: [PHP] again with the regex

2001-05-15 Thread Jerry Lake
PROTECTED] Subject: RE: [PHP] again with the regex Jerry, try sprintf(). Here's an example: sprintf("(%s) %s-%s", substr($GLOBALS["appPhoneHome"], 0, 3),substr($GLOBALS["appPhoneHome"], 3, 3),substr($GLOBALS["appPhoneHome"], 6, 4)) Kirk > -Origina

RE: [PHP] again with the regex

2001-05-15 Thread Jack Dempsey
if they all have the same format, then you can do this (don't need regexs) $number = '1234567890'; $formatted_number = '(' . substr($number,0,3) . ') ' . substr($number,3,3) . '-' . substr($number,6); -jack -Original Message- From: Jerry Lake [mailto:[EMAIL PROTECTED]] Sent: Tuesday, Ma

RE: [PHP] again with the regex

2001-05-15 Thread scott [gts]
well, if all numbers are *always* 10 digits long, use this $old = "1234567890"; $new = preg_match('/(\d{3})(\d{3})(\d{4})/', $old, $matches); print "(". $matches[1] .") ". $matches[2] ."-". $matches[3]; prints "(123) 456-7890" > -Original Message- > From: Jerry Lake [mailto:[EMAIL P

RE: [PHP] again with the regex

2001-05-15 Thread Johnson, Kirk
Jerry, try sprintf(). Here's an example: sprintf("(%s) %s-%s", substr($GLOBALS["appPhoneHome"], 0, 3),substr($GLOBALS["appPhoneHome"], 3, 3),substr($GLOBALS["appPhoneHome"], 6, 4)) Kirk > -Original Message- > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 15, 2001 4:48