diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-27 11:04:24 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-27 11:04:24 +0200 |
commit | acb962e5aa6fb607751dc2012ff6df25acbd518b (patch) | |
tree | faf96c4b915a5ea85336df9f4eb25a618a1a0578 /system/libraries/Form_validation.php | |
parent | 70f94006326196e4c5b79843c0f8e91984caa593 (diff) |
Use ctype_* functions in Form_validation instead of PCRE when possible
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r-- | system/libraries/Form_validation.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index e7b89d0c4..8e03e91f3 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1129,7 +1129,7 @@ class CI_Form_validation { */ public function alpha($str) { - return (bool) preg_match('/^[a-z]+$/i', $str); + return ctype_alpha($str); } // -------------------------------------------------------------------- @@ -1142,7 +1142,7 @@ class CI_Form_validation { */ public function alpha_numeric($str) { - return (bool) preg_match('/^[a-z0-9]+$/i', $str); + return ctype_alnum((string) $str); } // -------------------------------------------------------------------- @@ -1264,7 +1264,7 @@ class CI_Form_validation { */ public function is_natural($str) { - return (bool) preg_match('/^[0-9]+$/', $str); + return ctype_digit((string) $str); } // -------------------------------------------------------------------- @@ -1277,7 +1277,7 @@ class CI_Form_validation { */ public function is_natural_no_zero($str) { - return ($str != 0 && preg_match('/^[0-9]+$/', $str)); + return ($str != 0 && ctype_digit((string) $str)); } // -------------------------------------------------------------------- |