You are here

function _cck_phone_valid_input in Phone Number 7

Same name and namespace in other branches
  1. 6 cck_phone.module \_cck_phone_valid_input()
2 calls to _cck_phone_valid_input()
cck_phone_phone_number_validate in ./cck_phone.module
An #element_validate callback for the phone_number element.
_cck_phone_validate in ./cck_phone.module

File

./cck_phone.module, line 445
Defines phone number fields for CCK. Provide some verifications on the phone numbers

Code

function _cck_phone_valid_input($input) {

  // lenient checking, as long as don't have invalid phone number character
  $regex = '/^
    [\\s.()-]*     # optional separator
    (?:           # }
      \\d          # } 4-15 digits number
      [\\s.()-]*   # } each followed by optional separator
    ){' . CCK_PHONE_PHONE_MIN_LENGTH . ',' . CCK_PHONE_PHONE_MAX_LENGTH . '}       # }
    $/x';
  return preg_match($regex, $input);
}